home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / mflms101.arc / MFL_FUNC.MAN < prev    next >
Text File  |  1989-11-25  |  321KB  |  16,963 lines

  1. TITLE_PG.FM - Thu 23 Nov 89 00:19 - Page 1:  
  2.  
  3.     
  4.     
  5.     
  6.     
  7.     
  8.     
  9.     
  10.     
  11.     
  12.     
  13.     
  14.     
  15.                           The MicroFirm Function Library
  16.                              for Microsoft C & Quick C
  17.                                       ver 1.01
  18.     
  19.                  Copyright 1988-89 by Robert B. Stout dba MicroFirm
  20.                   portions Copyright 1986-87 by Stephen E. Margison
  21.                                 All rights reserved
  22.     
  23.     
  24.     
  25.     
  26.     
  27.                       ---------------------------------------
  28.                       LIBRARY FUNCTIONS IN ALPHABETICAL ORDER
  29.                       ---------------------------------------
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. AABORT.FNC - Thu 23 Nov 89 00:19 - Page 2:  
  68.  
  69.     NAME
  70.     
  71.             aabort -- terminate a program
  72.     
  73.     
  74.     PROTOTYPED IN:  mflsys.h
  75.     
  76.     
  77.     SYNOPSIS
  78.     
  79.             void aabort(code);
  80.             int code;     exit error code
  81.     
  82.     
  83.     DESCRIPTION
  84.     
  85.     The program is aborted (using the common_exit() function) after sending
  86.     the BELL character to stderr.  By using the common_exit() routine,
  87.     any common exit function which has been installed will be called.
  88.     
  89.     
  90.     EXAMPLE
  91.     
  92.             aabort(0);
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. ANSISYS.FNC - Thu 23 Nov 89 00:19 - Page 3:  
  134.  
  135.     NAME
  136.     
  137.             ansisys -- detects ANSI.SYS
  138.     
  139.     
  140.     PROTOTYPED IN:  mflsys.h
  141.     
  142.     
  143.     SYNOPSIS
  144.     
  145.             r = v_init();
  146.             LOGICAL r;      TRUE  if ANSI.SYS is loaded,
  147.                             FALSE if ANSI.SYS is not loaded,
  148.                             ERROR if function failed
  149.     
  150.     
  151.     DESCRIPTION
  152.     
  153.     The ansisys() function detects the presence of ANSI.SYS or compatible
  154.     device driver (e.g. ZANSI, FANSI, etc.) Note that ansisys() requires a PC
  155.     to be closely compatible with IBM at the BIOS interrupt level.
  156.     
  157.     
  158.     EXAMPLE
  159.     
  160.             LOGICAL aflag;
  161.             if (ERROR == (aflag = ansisys()))
  162.                     puts("can't tell if ANSI.SYS is loaded");
  163.             else    printf("ANSI.SYS is%s loaded\n", aflag ? "" : "n't");
  164.     
  165.     
  166.     SEE ALSO: make_ansi()
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. ARGVAL.FNC - Thu 23 Nov 89 00:19 - Page 4:  
  200.  
  201.     NAME
  202.     
  203.             argval -- convert an ASCII numerical string from an argument
  204.     
  205.     
  206.     PROTORYPED IN:  mflstrng.h
  207.     
  208.     
  209.     SYNOPSIS
  210.     
  211.             i = argval(string, dest, i);
  212.             int i;         index into the current argument string
  213.                            which is returned incremented to the
  214.                            first character after the numerical string
  215.             char *string;  the string containing the numerical value
  216.             int dest;      destination for resultant integer value
  217.     
  218.     
  219.     DESCRIPTION
  220.     
  221.     This function is primarily intended to parse command line arguments
  222.     containing numerical values into an integer.  The function will
  223.     abort the program if the index points to a non-numeric digit
  224.     upon entry with an error message and the option character which
  225.     preceeds the index pointer.
  226.     Numeric values cannot exceed four characters without causing
  227.     potential damage to the program by overrunning the character
  228.     storage area.
  229.     
  230.     
  231.     EXAMPLE
  232.     
  233.             assume argv[1] = "-M30C"
  234.     
  235.             int i, value;
  236.             i = 2    /* i is incremented to '3' by other code */
  237.             i = argval(&argv[1], value, i);
  238.     
  239.             after execution, i = 4 (pointing to 'C')
  240.                              value = 30
  241.                              argv[1] is unchanged
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. ATR2ANSI.FNC - Thu 23 Nov 89 00:19 - Page 5:  
  266.  
  267.     NAME
  268.     
  269.             make_ansi -- translate video attributes to ANSI strings
  270.     
  271.     
  272.     PROTOTYPED IN:  mflconio.h
  273.     
  274.     
  275.     SYNOPSIS
  276.     
  277.             astring = make_ansi(vattr);
  278.             char *astring;  the returned ANSI string
  279.             int vattr;      video attribute
  280.     
  281.     
  282.     DESCRIPTION
  283.     
  284.     Given a standard video attribute byte, make_ansi() tanslates it
  285.     into an ANSI control string.
  286.     
  287.     
  288.     EXAMPLE
  289.     
  290.            char *astring;
  291.            astring = make_ansi(YELLOW+(BLUE<<4));
  292.     
  293.     
  294.     SEE ALSO: ansisys()
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331. BADEXT.FNC - Thu 23 Nov 89 00:19 - Page 6:  
  332.  
  333.     NAME
  334.     
  335.             badext -- report invalid filename extension and exit
  336.     
  337.     
  338.     PROTOTYPED IN:  mflfiles.h
  339.     
  340.     
  341.     SYNOPSIS
  342.     
  343.             void badext(ext);
  344.             char *ext;
  345.     
  346.     
  347.     DESCRIPTION
  348.     
  349.     This function may be used when an invalid filename extension must
  350.     cause the termination of a program.  It is called with the
  351.     offending extension as the argument string.  An error message
  352.     is sent to stderr, and the program terminates via the aabort()
  353.     function of this library.
  354.     
  355.     
  356.     SEE ALSO: exttyp()
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397. BITCLR.FNC - Thu 23 Nov 89 00:19 - Page 7:  
  398.  
  399.     NAME
  400.     
  401.             BitClr            -- clear n'th bit
  402.     
  403.     
  404.     DEFINED IN:  mfldefs.h
  405.     
  406.     
  407.     SYNOPSIS
  408.     
  409.             BitClr(data,posn);
  410.             void data;      may be char, int, or long
  411.             int posn;       bit position to reset to 0; 0 = LSB
  412.     
  413.     
  414.     DESCRIPTION
  415.     
  416.     The BitClr() function resets a particular bit to zero for a char, int
  417.     or long data variable.
  418.     
  419.     
  420.     EXAMPLE
  421.     
  422.                 int flag;
  423.                 int mask=0xf0;              /* mask (binary) = 11110000     */
  424.                 mask = BitClr(mask,14);     /* mask (binary) = 10110000     */
  425.     
  426.     
  427.     SEE ALSO: BitSet(), BitTst()
  428.     
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. BITSET.FNC - Thu 23 Nov 89 00:19 - Page 8:  
  464.  
  465.     NAME
  466.     
  467.             BitSet            -- set n'th bit
  468.     
  469.     
  470.     DEFINED IN:  mfldefs.h
  471.     
  472.     
  473.     SYNOPSIS
  474.     
  475.             BitSet(data,posn);
  476.             void data;      may be char, int, or long
  477.             int posn;       bit position to set to 1; 0 = LSB
  478.     
  479.     
  480.     DESCRIPTION
  481.     
  482.     The bitset() function sets a particular bit to 1 for a char, int or
  483.     long variable.
  484.     
  485.     
  486.     EXAMPLE
  487.     
  488.             int flag;
  489.             int mask=0xf0;              /* mask (binary) = 11110000     */
  490.             mask = BitSet(mask,1);      /* mask (binary) = 10110010     */
  491.     
  492.     
  493.     SEE ALSO: BitClr(), BitTst()
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529. BITTST.FNC - Thu 23 Nov 89 00:19 - Page 9:  
  530.  
  531.     NAME
  532.     
  533.             BitTst -- test n'th bit
  534.     
  535.     
  536.     DEFINED IN:  mfldefs.h
  537.     
  538.     
  539.     SYNOPSIS
  540.     
  541.             BitTst(data,posn);
  542.             void data;      may be char, int, or long
  543.             int posn;       bit position to return; 0 = LSB
  544.     
  545.     
  546.     DESCRIPTION
  547.     
  548.     The BitTst() function returns the bit position of a particular bit
  549.     from a char, int or long variable.
  550.     
  551.     
  552.     EXAMPLE
  553.         
  554.             int flag;
  555.             flag = BitTst(mask,4);      /* flag = TRUE                  */
  556.     
  557.     
  558.     SEE ALSO: BitClr(), BitSet()
  559.     
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595. BLPR.FNC - Thu 23 Nov 89 00:19 - Page 10:  
  596.  
  597.     NAME
  598.     
  599.             blpr -- write a character to LPT? through BIOS 17H
  600.     
  601.     
  602.     PROTOTYPED IN:  mflsys.h
  603.     
  604.     
  605.     SYNOPSIS
  606.     
  607.             r = blpr(chr, num);
  608.             int r;    returns status in low 8 bits
  609.             char chr; character to write
  610.             int num;  printer number 0-2
  611.     
  612.     
  613.     DESCRIPTION
  614.     
  615.     The blpr() function writes a character to LPT?.  This assembly
  616.     language routine provides very low-level access to the LPT1 - LPT3
  617.     drivers in the ROM-BIOS.  Because of this dependency upon the ROM-BIOS
  618.     Interrupt 17H, this function may not work on all compatibles.  The
  619.     normal DOS channel PRN: is bypassed, as is any re-assignment of LPT?.
  620.     Normally, this routine is not used directly; rather, it is accessed
  621.     through the "pr" series subroutine calls.
  622.     
  623.             Status bits are returned as follows:  (meaning is with bit set)
  624.                bit 0 = time out
  625.                bit 1,2 are unused and should be ignored
  626.                bit 3 = I/O error
  627.                bit 4 = Printer Selected
  628.                bit 5 = Out of Paper
  629.                bit 6 = Acknowledged
  630.                bit 7 = Not Busy
  631.     
  632.     
  633.     EXAMPLE
  634.     
  635.             int i;
  636.             i = blprstat(0);     /* LPT1: is 0 */
  637.             if(!(i & 0x80)) puts("Printer is busy");
  638.             else blpr('A', 0);
  639.     
  640.     
  641.     SEE ALSO: blprstat
  642.     
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661. BLPRSTAT.FNC - Thu 23 Nov 89 00:19 - Page 11:  
  662.  
  663.     NAME
  664.     
  665.             blprstat -- get LPT? status through BIOS 17H
  666.     
  667.     
  668.     PROTOTYPED IN:  mflsys.h
  669.     
  670.     
  671.     SYNOPSIS
  672.     
  673.             r = blprstat(num);
  674.             int r;    returns status in low 8 bits
  675.             int num;  printer number 0-2
  676.     
  677.     
  678.     DESCRIPTION
  679.     
  680.     The blprstat() function obtains printer status.  This function
  681.     provides very low-level access to the LPT1 - LPT3 drivers in the
  682.     ROM-BIOS.  Because of this dependency upon the ROM-BIOS Interrupt 17H,
  683.     this function may not work on all compatibles.  The normal DOS channel
  684.     PRN: is bypassed, as is any re-assignment of LPT?. Normally, this
  685.     function are not used directly; rather, it is accessed through the
  686.     "pr" series subroutine calls.
  687.     
  688.     Status bits are returned as follows:  (meaning is with bit set)
  689.         bit 0 = time out
  690.         bit 1,2 are unused and should be ignored
  691.         bit 3 = I/O error
  692.         bit 4 = Printer Selected
  693.         bit 5 = Out of Paper
  694.         bit 6 = Acknowledged
  695.         bit 7 = Not Busy
  696.     
  697.     
  698.     EXAMPLE
  699.     
  700.             int i;
  701.             i = blprstat(0);     /* LPT1: is 0 */
  702.             if(!(i & 0x80)) puts("Printer is busy");
  703.             else blpr('A', 0);
  704.     
  705.     
  706.     SEE ALSO: blpr()
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727. BPUTC.FNC - Thu 23 Nov 89 00:19 - Page 12:  
  728.  
  729.     NAME
  730.     
  731.             Bputc  -- write a character using BIOS only
  732.     
  733.     
  734.     DEFINED IN:  mfldefs.h
  735.     
  736.     SYNOPSIS
  737.     
  738.             Bputc(character);
  739.             char character; character to write
  740.     
  741.     DESCRIPTION
  742.     
  743.     Since DOS is not re-entrant, you cannot (in general) call DOS
  744.     functions from within interrupt handlers, including Ctrl-Break and
  745.     critical error handlers as supported by ctlbrk() or criterr(). This
  746.     function works identically to fputc(stderr) except that it writes
  747.     directly to the screen via BIOS, bypassing all DOS calls. The only
  748.     caution is that writing a '\n' using Bputc only causes a line feed.
  749.     To achieve the normal (for C) newline function, you must either
  750.     explicitly write an additional '\r' or simply use Bputs("\n")
  751.     instead. 
  752.     
  753.     
  754.     EXAMPLE
  755.     
  756.             Bputc('\a');
  757.     
  758.     
  759.     SEE ALSO: Bputs(), ctlbrk(), criterr()
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793. BPUTS.FNC - Thu 23 Nov 89 00:19 - Page 13:  
  794.  
  795.     NAME
  796.     
  797.             Bputs     -- write a string using BIOS only
  798.     
  799.     
  800.     PROTOTYPED IN:  mflconio.h
  801.     
  802.     
  803.     SYNOPSIS
  804.     
  805.             Bputs(string);
  806.             char *string;   string to write
  807.     
  808.     
  809.     DESCRIPTION
  810.     
  811.     Since DOS is not re-entrant, you cannot (in general) call DOS
  812.     functions from within interrupt handlers, including Ctrl-Break and
  813.     critical error handlers as supported by ctlbrk() or criterr().  This
  814.     functions works identically to fputs(stderr) except that it writes
  815.     directly to the screen via BIOS, bypassing all DOS calls. Note that
  816.     newline characters are properly translated into CR-LF pairs.
  817.     
  818.     
  819.     EXAMPLE
  820.     
  821.             Bputs("Something's wrong!\n");
  822.     
  823.     
  824.     SEE ALSO: Bputc
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859. CANT.FNC - Thu 23 Nov 89 00:19 - Page 14:  
  860.  
  861.     NAME
  862.     
  863.             cant -- report inability to open a file and exit
  864.     
  865.     
  866.     PROTOTYPED IN:  mflfiles.h
  867.     
  868.     
  869.     SYNOPSIS
  870.     
  871.             void cant(name);
  872.             char *name; filename to display
  873.     
  874.     
  875.     DESCRIPTION
  876.     
  877.     This function is used to report a failure to open a file of
  878.     "name", and then abort the program through the aabort() function
  879.     of this library.
  880.     
  881.     
  882.     EXAMPLE
  883.              cant("foo.bar");
  884.              cant(argv[1]);
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925. CENTER.FNC - Thu 23 Nov 89 00:19 - Page 15:  
  926.  
  927.     NAME
  928.     
  929.             center -- center a string
  930.     
  931.     
  932.     PROTOTYPED IN:  mflstrng.h
  933.     
  934.     
  935.     SYNOPSIS
  936.     
  937.             r = center(string, size);
  938.             int r;         starting column for centering
  939.             char *string;  string to center
  940.             int size;      width of field for centering
  941.     
  942.     
  943.     DESCRIPTION
  944.     
  945.     This function returns the starting column to print a string for the
  946.     string to be centered in a field of "size" characters.  For the
  947.     screen, the width would usually be 80, and for printers, either 80 or
  948.     132. The string MUST NOT BE longer than the size specified, since
  949.     there is no error cheking for this condition and an unusable result
  950.     will be returned.
  951.     
  952.     
  953.     EXAMPLE
  954.     
  955.        char title[] = "Title of Program";
  956.     
  957.        main() {
  958.           int i;
  959.           i = center(title, 80);
  960.           d_say(2, i, title);     /* display title centered in row 2 */
  961.           }
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991. CHDRV.FNC - Thu 23 Nov 89 00:19 - Page 16:  
  992.  
  993.     NAME
  994.     
  995.             chdrv   -- change disk drives
  996.     
  997.     
  998.     PROTOTYPED IN:  mflfiles.h
  999.     
  1000.     
  1001.     SYNOPSIS
  1002.     
  1003.             r = chdrv(drive);
  1004.             int r;          returns ERROR if drive is invalid
  1005.             char drive;     drive ('A' - 'Z') to check
  1006.     
  1007.     
  1008.     DESCRIPTION
  1009.     
  1010.     Chdrv() as an anlog of the chdir() function which changes drives
  1011.     rather than directories. It is not necesary, when using chdrv(), to
  1012.     validate the target drive using drvalid() since this is done
  1013.     automatically by chdrv().
  1014.     
  1015.     
  1016.     EXAMPLE
  1017.     
  1018.             char drive;
  1019.     
  1020.             if ('C' != drive) {
  1021.                   if (!chdrv('C'))
  1022.                        puts("changed to drive C:");
  1023.                   else puts("\aunable to change drives");
  1024.             }
  1025.     
  1026.     
  1027.     SEE ALSO: getdrv(), drvalid()
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057. CHKCTS.FNC - Thu 23 Nov 89 00:19 - Page 17:  
  1058.  
  1059.     NAME
  1060.     
  1061.             chkcts -- check state of clear to send flag
  1062.     
  1063.     
  1064.     PROTOTYPED IN:  mflsys.h
  1065.     
  1066.     
  1067.     SYNOPSIS
  1068.     
  1069.              r = chkcts(port);
  1070.              int r;           TRUE or FALSE, depending upon state
  1071.              int port;        0, 1, 2, or 3 (for COM1-COM4)
  1072.     
  1073.     
  1074.     DESCRIPTION
  1075.     
  1076.     This function is part of a set of assembly language functions which
  1077.     provide direct access to the serial communications chips for the
  1078.     fastest access possible.  Calling chkcts() checks the status of the
  1079.     clear to send and returns its state as TRUE (on) or FALSE (off).
  1080.     The port parameter may be specified as integers 0-3, or SER1 to SER4
  1081.     as defined in <mflsys.h>.
  1082.     
  1083.     
  1084.     EXAMPLE
  1085.     
  1086.             int sport;        /* serial port */
  1087.     
  1088.             sport = SER2;     /* let it point to COM2 */
  1089.             if(chkdcd(sport)) puts("Ok to send");
  1090.             else puts("Don't send data now");
  1091.     
  1092.     
  1093.     SEE ALSO: chkdcd(), chkdsr(), chkring()
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123. CHKDCD.FNC - Thu 23 Nov 89 00:19 - Page 18:  
  1124.  
  1125.     NAME
  1126.     
  1127.             chkdcd -- check state of carrier detect flag
  1128.     
  1129.     
  1130.     PROTOTYPED IN:  mflsys.h
  1131.     
  1132.     
  1133.     SYNOPSIS
  1134.     
  1135.             r = chkdcd(port);
  1136.             int r;           TRUE or FALSE, depending upon state
  1137.             int port;        0, 1, 2, or 3 (for COM1-COM4)
  1138.     
  1139.     
  1140.     DESCRIPTION
  1141.     
  1142.     This function is part of a set of assembly language functions which
  1143.     provide direct access to the serial communications chips for the
  1144.     fastest access possible.  Calling chkdcd() checks the status of the
  1145.     carrier detect flag and returns its state as TRUE (on) or FALSE (off).
  1146.     The port parameter may be specified as integers 0-3, or SER1 to SER4
  1147.     as defined in <mflsys.h>.
  1148.     
  1149.     
  1150.     EXAMPLE
  1151.     
  1152.             int sport;        /* serial port */
  1153.     
  1154.             sport = SER2;     /* let it point to COM2 */
  1155.             if(chkdcd(sport)) puts("We have a carrier detected");
  1156.             else puts("The modem is apparently idle");
  1157.     
  1158.     
  1159.     SEE ALSO: chkdsr(), chkcts(), chkring()
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189. CHKDSR.FNC - Thu 23 Nov 89 00:19 - Page 19:  
  1190.  
  1191.     NAME
  1192.     
  1193.             chkdsr -- check state of data set ready flag
  1194.     
  1195.     
  1196.     PROTOTYPED IN:  mflsys.h
  1197.     
  1198.     
  1199.     SYNOPSIS
  1200.     
  1201.             r = chkdsr(port);
  1202.             int r;           TRUE or FALSE, depending upon state
  1203.             int port;        0, 1, 2, or 3 (for COM1-COM4)
  1204.     
  1205.     
  1206.     DESCRIPTION
  1207.     
  1208.     This function is part of a set of assembly language functions which
  1209.     provide direct access to the serial communications chips for the
  1210.     fastest access possible.  Calling chkdsr() checks the status of the
  1211.     data set ready flag and returns its state as TRUE (on) or FALSE (off).
  1212.     The port parameter may be specified as integers 0-3, or SER1 to SER4
  1213.     as defined in <mflsys.h>.
  1214.     
  1215.     
  1216.     EXAMPLE
  1217.     
  1218.             int sport;        /* serial port */
  1219.     
  1220.             sport = SER2;     /* let it point to COM2 */
  1221.             if(chkdsr(sport)) puts("DSR flag is set");
  1222.                 else puts("DSR flag is not set");
  1223.     
  1224.     
  1225.     SEE ALSO: chkdcd(), chkcts(), chkring()
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255. CHKRING.FNC - Thu 23 Nov 89 00:19 - Page 20:  
  1256.  
  1257.     NAME
  1258.     
  1259.             chkring -- check state of ring indicator flag
  1260.     
  1261.     
  1262.     PROTOTYPED IN:  mflsys.h
  1263.     
  1264.     
  1265.     SYNOPSIS
  1266.     
  1267.             r = chkring(port);
  1268.             int r;           TRUE or FALSE, depending upon state
  1269.             int port;        0, 1, 2, or 3 (for COM1-COM4)
  1270.     
  1271.     
  1272.     DESCRIPTION
  1273.     
  1274.     This function is part of a set of assembly language functions which
  1275.     provide direct access to the serial communications chips for the
  1276.     fastest access possible.  Calling chkring() checks the status of the
  1277.     ring indicator flag and returns its state as TRUE (on) or FALSE (off).
  1278.     The port parameter may be specified as integers 0-3, or SER1 to SER4
  1279.     as defined in <mflsys.h>.
  1280.     
  1281.     
  1282.     EXAMPLE
  1283.     
  1284.             int sport;        /* serial port */
  1285.     
  1286.             sport = SER2;     /* let it point to COM2 */
  1287.             if(chkring(sport)) puts("Ring indicator flag is set");
  1288.             else puts("Ring indicator flag is not set");
  1289.     
  1290.     
  1291.     SEE ALSO: chkdcd(), chkdsr(), chkcts()
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321. CLR_GAME.FNC - Thu 23 Nov 89 00:19 - Page 21:  
  1322.  
  1323.     NAME
  1324.     
  1325.             clr_game() --- clear pending input from game port
  1326.     
  1327.     
  1328.     PROTOTYPED IN:  mflsys.h
  1329.     
  1330.     
  1331.     SYNOPSIS
  1332.     
  1333.             (void)clear_game();
  1334.     
  1335.     
  1336.     DESCRIPTION
  1337.     
  1338.     Calling clear_game() clears any pending input and forces the debouncer
  1339.     to assume a new input sequence.
  1340.     
  1341.     
  1342.     EXAMPLE
  1343.     
  1344.             main() {
  1345.             unsigned char i;
  1346.             init_game(FALSE);    /* allow only single switch inputs */
  1347.             for ever() {
  1348.                   debounce();       /* call this regularly */
  1349.                   i = get_press();
  1350.                   if(i is 0) continue;
  1351.                   printf("switch value is %x\n", i);
  1352.                   }
  1353.             }
  1354.     
  1355.     
  1356.     SEE ALSO: init_game(), getpress(), debounce()
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387. CLRCAPS.FNC - Thu 23 Nov 89 00:19 - Page 22:  
  1388.  
  1389.     NAME
  1390.     
  1391.             clrcaps() -- sets Caps lock to OFF
  1392.     
  1393.     
  1394.     PROTOTYPED IN:  mflconio.h
  1395.     
  1396.     
  1397.     SYNOPSIS
  1398.     
  1399.             clrcaps();
  1400.     
  1401.     
  1402.     DESCRIPTION
  1403.     
  1404.     This function forces the caps lock status flag to OFF.
  1405.     
  1406.     
  1407.     EXAMPLE
  1408.                 setcaps();
  1409.                 if(kbstate(2)) puts("Caps lock is now set");
  1410.                 else puts("Caps lock is NOT set");
  1411.                 clrcaps();
  1412.                 puts("Caps lock should now be off");
  1413.     
  1414.     
  1415.     SEE ALSO: _kbstate(), kbstatus(), setcaps(), clrcaps(), setnumlock(),
  1416.               clrnumlock()
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453. CLRFIELD.FNC - Thu 23 Nov 89 00:19 - Page 23:  
  1454.  
  1455.     NAME
  1456.     
  1457.             clrfield -- clear a screen field through BIOS
  1458.     
  1459.     
  1460.     PROTOTYPED IN:  mflconio.h
  1461.     
  1462.     
  1463.     SYNOPSIS
  1464.     
  1465.             void clrfield(row, col, size, page);
  1466.             int row, col;    starting point
  1467.             int size;        number of columns to clear ( <= 80)
  1468.             int page;        video page number
  1469.                              (for non-CGA, specify 0)
  1470.     
  1471.     DESCRIPTION
  1472.     
  1473.     This function handles the problem of clearing a section of a line on
  1474.     the screen without clearing to the end of the line. If the size
  1475.     parameter is larger than 80, it is forced to 80.
  1476.     
  1477.     
  1478.     EXAMPLE
  1479.     
  1480.              clrfield(10, 20, 15, 0);  /* clear 15 columns on page 0
  1481.                                           starting at row 10, column 20 */
  1482.     
  1483.     
  1484.     SEE ALSO: disp_clrfield
  1485.     
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519. CLRNMLOC.FNC - Thu 23 Nov 89 00:19 - Page 24:  
  1520.  
  1521.     NAME
  1522.     
  1523.             clrnmloc() --- turns numlock off
  1524.     
  1525.     
  1526.     PROTOTYPED IN:  mflconio.h
  1527.     
  1528.     
  1529.     SYNOPSIS
  1530.     
  1531.             clrnumlock();
  1532.     
  1533.     
  1534.     DESCRIPTION
  1535.     
  1536.     This function forces the numlok status flag to OFF.
  1537.     
  1538.     
  1539.     EXAMPLE
  1540.             setnumlok();
  1541.             if(kbstate(2)) puts("Num lock is now set");
  1542.             else puts("Num lock is NOT set");
  1543.             clrnumlock();
  1544.             puts("Num lock should now be off");
  1545.     
  1546.     
  1547.     SEE ALSO: _kbstate(), kbstatus(), setcaps(), clrcaps(), setnumlock(),
  1548.               clrnumlock()
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585. CLS.FNC - Thu 23 Nov 89 00:19 - Page 25:  
  1586.  
  1587.     NAME
  1588.     
  1589.             cls -- clear screen and home cursor
  1590.     
  1591.     
  1592.     PROTOTYPED IN:  mflconio.h
  1593.     
  1594.     
  1595.     SYNOPSIS
  1596.     
  1597.             void cls();
  1598.     
  1599.     DESCRIPTION
  1600.     
  1601.     This function clears the screen on page 0 and places the
  1602.     cursor in the upper left-hand corner.  It is simply an
  1603.     invocation of two other functions:
  1604.     
  1605.          d_cls();
  1606.          d_pos(0, 0, 0);
  1607.     
  1608.     
  1609.     EXAMPLE
  1610.     
  1611.          cls();
  1612.     
  1613.     
  1614.     SEE ALSO: d_cls()
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651. CLSDIR.FNC - Thu 23 Nov 89 00:19 - Page 26:  
  1652.  
  1653.     NAME
  1654.     
  1655.             closedir  -- close a directory
  1656.     
  1657.     
  1658.     PROTOTYPED IN:  mflfiles.h
  1659.     
  1660.     
  1661.     SYNOPSIS
  1662.     
  1663.             void closedir(d1);
  1664.             DOS_DIR *d1;    directory file pointer
  1665.     
  1666.     
  1667.     DESCRIPTION
  1668.     
  1669.     The closedir() function closes the open directory whose file pointer
  1670.     is passed, just as fclose() closes normal DOS files.
  1671.     
  1672.     
  1673.     EXAMPLE
  1674.     
  1675.             char *name[] = "C:\looney\bin";
  1676.             DOS_DIR *dirp;
  1677.             struct FIND *ffblk;
  1678.     
  1679.             if(dirp=opendir(name))
  1680.             {
  1681.                 printf("%s contains %d entries\n", name, dirp->dd_size);
  1682.                 while (ffblk=readdir(dirp))
  1683.                 {
  1684.                     printf("%3d - %s\n", dirp->dd_loc, ffblk->name);
  1685.                 }
  1686.                 closedir(dirp);
  1687.             }
  1688.     
  1689.     
  1690.     SEE ALSO: readdir(), opendir()
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717. CRC2CLR.FNC - Thu 23 Nov 89 00:19 - Page 27:  
  1718.  
  1719.     NAME
  1720.     
  1721.             crc16_clr() --- clear crc value
  1722.     
  1723.     
  1724.     PROTOTYPED IN:  mflmath.h
  1725.     
  1726.     
  1727.     SYNOPSIS
  1728.     
  1729.             r = crc16_clear();
  1730.             unsigned r;     16-bit crc to clear
  1731.     
  1732.     
  1733.     DESCRIPTION
  1734.     
  1735.     This function is part of a group of functions used to do crc
  1736.     calculations.  crc16_clear is used to clear the crc value. However,
  1737.     if speed is a concern, just zero the crc value since crc16_clear
  1738.     does nothing other than return a zero.
  1739.     
  1740.     
  1741.     EXAMPLE
  1742.     
  1743.             unsigned crc;
  1744.             crc = crc16_clear();
  1745.             /* for each character processed: */
  1746.             crc = crc16_update(crc, next_chr);
  1747.             /* finally, */
  1748.             crc = crc16_finish;
  1749.     
  1750.     NOTE:
  1751.     These functions are from a public domain source, author unknown,  They
  1752.     are not copyrighted.
  1753.     
  1754.     
  1755.     SEE ALSO: crc16_update(), crc16_finish(), crc32_clear() crc32_update(),
  1756.               crc32_finish()
  1757.     
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783. CRC2FNSH.FNC - Thu 23 Nov 89 00:19 - Page 28:  
  1784.  
  1785.     NAME
  1786.     
  1787.             crc16_finish() --- finish crc calculation
  1788.     
  1789.     
  1790.     PROTOTYPED IN:  mflmath.h
  1791.     
  1792.     
  1793.     SYNOPSIS
  1794.     
  1795.             r = crc16_finish(crc);
  1796.             unsigned r;     final 16-bit crc value
  1797.             unsigned crc;   old 16-bit crc value
  1798.     
  1799.     
  1800.     DESCRIPTION
  1801.     
  1802.     This function is part of a group of functions used to do crc
  1803.     calculations. Calling crc16_finish() crc16_finish actually calls
  1804.     crc16_update twice with a value of 0 in order to flush the 16 bit
  1805.     calculation and return the final crc calculation.  As supplied, the
  1806.     CCITT calculation polynomial is used.  The source can be easily
  1807.     changed to CRC16 if desired.
  1808.     
  1809.     
  1810.     EXAMPLE
  1811.     
  1812.             unsigned crc;
  1813.             crc = crc16_clear();
  1814.             /* for each character processed: */
  1815.             crc = crc16_update(crc, next_chr);
  1816.             /* finally, */
  1817.             crc = crc16_finish;
  1818.     
  1819.     
  1820.     NOTE:
  1821.     These functions are from a public domain source, author
  1822.     unknown,  They are not copyrighted.
  1823.     
  1824.     
  1825.     SEE ALSO: crc16_clear(), crc16_update(), crc32_clear(), crc32_update(),
  1826.               crc32_finish()
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849. CRC2UPDT.FNC - Thu 23 Nov 89 00:19 - Page 29:  
  1850.  
  1851.     NAME
  1852.     
  1853.             crc16_update() --- update crc value
  1854.     
  1855.     
  1856.     PROTOTYPED IN:  mflmath.h
  1857.     
  1858.     
  1859.     SYNOPSIS
  1860.     
  1861.             r = crc16_update(crc, chr);
  1862.             unsigned r;     new 16-bit crc value
  1863.             unsigned crc;   old 16-bit crc value
  1864.             char chr;       datum
  1865.     
  1866.     
  1867.     DESCRIPTION
  1868.     
  1869.     This function is part of a group of functions used to do crc
  1870.     calculations.  crc16_update is called once for each character to add to
  1871.     the crc. It receives the running crc and the character to be added. As
  1872.     supplied, the CCITT calculation polynomial is used.  The source can be
  1873.     easily changed to CRC16 if desired.
  1874.     
  1875.     
  1876.     EXAMPLE
  1877.     
  1878.             unsigned crc;
  1879.             crc = crc16_clear();
  1880.             /* for each character processed: */
  1881.             crc = crc16_update(crc, next_chr);
  1882.             /* finally, */
  1883.             crc = crc16_finish;
  1884.     
  1885.     
  1886.     NOTE:
  1887.     These functions are from a public domain source, author unknown,  They
  1888.     are not copyrighted.
  1889.     
  1890.     
  1891.     SEE ALSO: crc16_clear(), crc16_finish(), crc32_clear(), crc32_update(),
  1892.               crc32_finish()
  1893.     
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915. CRC4CLR.FNC - Thu 23 Nov 89 00:19 - Page 30:  
  1916.  
  1917.     NAME
  1918.     
  1919.             crc32_clr() --- clear crc value
  1920.     
  1921.     
  1922.     PROTOTYPED IN:  mflmath.h
  1923.     
  1924.     
  1925.     SYNOPSIS
  1926.     
  1927.             r = crc32_clear();
  1928.             unsigned long r;        32-bit crc to clear
  1929.     
  1930.     
  1931.     DESCRIPTION
  1932.     
  1933.     This function is part of a group of functions used to do crc
  1934.     calculations.  crc32_clear is used to clear the crc value. However,
  1935.     if speed is a concern, just zero the crc value since crc32_clear
  1936.     does nothing other than return a zero.
  1937.     
  1938.     
  1939.     EXAMPLE
  1940.     
  1941.             unsigned long crc;
  1942.             crc = crc32_clear();
  1943.             /* for each character processed: */
  1944.             crc = crc32_update(crc, next_chr);
  1945.             /* finally, */
  1946.             crc = crc32_finish;
  1947.     
  1948.     NOTE:
  1949.     These functions are from a public domain source, author unknown,  They
  1950.     are not copyrighted.
  1951.     
  1952.     
  1953.     SEE ALSO: crc32_update(), crc32_finish(), crc16_clear(), crc16_update(),
  1954.               crc16_finish()
  1955.     
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981. CRC4FNSH.FNC - Thu 23 Nov 89 00:19 - Page 31:  
  1982.  
  1983.     NAME
  1984.     
  1985.             crc32_finish() --- finish crc calculation
  1986.     
  1987.     
  1988.     PROTOTYPED IN:  mflmath.h
  1989.     
  1990.     
  1991.     SYNOPSIS
  1992.     
  1993.             r = crc32_finish(crc);
  1994.             unsigned long r;        final 32-bit crc value
  1995.             unsigned long crc;      old 32-bit crc value
  1996.     
  1997.     
  1998.     DESCRIPTION
  1999.     
  2000.     This function is part of a group of functions used to do crc
  2001.     calculations. Calling crc32_finish() crc32_finish actually calls
  2002.     crc32_update twice with a value of 0 in order to flush the 16 bit
  2003.     calculation and return the final crc calculation.  As supplied, the
  2004.     CCITT calculation polynomial is used.  The source can be easily
  2005.     changed if desired.
  2006.     
  2007.     
  2008.     EXAMPLE
  2009.     
  2010.             unsigned long crc;
  2011.             crc = crc32_clear();
  2012.             /* for each character processed: */
  2013.             crc = crc32_update(crc, next_chr);
  2014.             /* finally, */
  2015.             crc = crc32_finish;
  2016.     
  2017.     
  2018.     NOTE:
  2019.     These functions are from a public domain source, author
  2020.     unknown,  They are not copyrighted.
  2021.     
  2022.     
  2023.     SEE ALSO: crc32_clear(), crc32_update(), crc16_clear(), crc16_update(),
  2024.               crc16_finish()
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047. CRC4UPDT.FNC - Thu 23 Nov 89 00:19 - Page 32:  
  2048.  
  2049.     NAME
  2050.     
  2051.             crc32_update() --- update crc value
  2052.     
  2053.     
  2054.     PROTOTYPED IN:  mflmath.h
  2055.     
  2056.     
  2057.     SYNOPSIS
  2058.     
  2059.             r = crc32_update(crc, chr);
  2060.             unsigned long r;        new 32-bit crc value
  2061.             unsigned long crc;      old 32-bit crc value
  2062.             char chr;               new datum
  2063.     
  2064.     
  2065.     DESCRIPTION
  2066.     
  2067.     This function is part of a group of functions used to do crc
  2068.     calculations.  crc32_update is called once for each character to add to
  2069.     the crc. It receives the running crc and the character to be added. As
  2070.     supplied, the CCITT calculation polynomial is used.  The source can be
  2071.     easily changed to CRC16 if desired.
  2072.     
  2073.     
  2074.     EXAMPLE
  2075.     
  2076.             unsigned long crc;
  2077.             crc = crc32_clear();
  2078.             /* for each character processed: */
  2079.             crc = crc32_update(crc, next_chr);
  2080.             /* finally, */
  2081.             crc = crc32_finish;
  2082.     
  2083.     
  2084.     NOTE:
  2085.     These functions are from a public domain source, author unknown,  They
  2086.     are not copyrighted.
  2087.     
  2088.     
  2089.     SEE ALSO: crc32_clear(), crc32_finish(), crc16_clear(), crc16_update(),
  2090.               crc16_finish()
  2091.     
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113. CRYPT.FNC - Thu 23 Nov 89 00:19 - Page 33:  
  2114.  
  2115.     NAME
  2116.     
  2117.             crypt -- encrypt/decrypt data
  2118.     
  2119.     
  2120.     PROTOTYPED IN:  mflsys.h
  2121.     
  2122.     
  2123.     SYNOPSIS
  2124.     
  2125.             crypt(buf);
  2126.             char *buf;      datum to encrypt
  2127.     
  2128.     
  2129.     DESCRIPTION
  2130.     
  2131.     crypt implements a fully-reversible encryption algorithm
  2132.     which is simultaneously simple and fast, yet reasonably
  2133.     secure. The algorithm used is compatible with both the LYNX
  2134.     and CRYPT utilities of the MicroFirm Toolkit, ver 3.00 or
  2135.     later, and the crypt function of the CXL windowing library.
  2136.     
  2137.     
  2138.     EXAMPLE
  2139.     
  2140.            /* following externs declared in MFLSYS.H        */
  2141.            extern char *cryptext;   /* the encryption key   */
  2142.            extern int crypt_ptr;
  2143.            extern int crypt_length;
  2144.            char *buf;               /* data to encrypt      */
  2145.            crypt_ptr = 0;           /* reset key pointer    */
  2146.            crypt_length = strlen(cryptext);
  2147.            while (*buf) {
  2148.                   *buf = crypt(*buf);
  2149.                   ++buf;
  2150.            }
  2151.     
  2152.     
  2153.     SEE ALSO: crypt_install(), cryptqual()
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179. CRYPTQUL.FNC - Thu 23 Nov 89 00:19 - Page 34:  
  2180.  
  2181.     NAME
  2182.     
  2183.             cryptqual  -- qualify an encryption key
  2184.     
  2185.     
  2186.     PROTOTYPED IN:  mflsys.h
  2187.     
  2188.     
  2189.     SYNOPSIS
  2190.     
  2191.             r = cryptqual(key, keyl);
  2192.             LOGICAL r;      SUCCESS if key qualifies, else ERROR
  2193.             char *key;      prospective encryption key to test
  2194.             int keyl;       number of unique characters required to qualify
  2195.                             key (range 1-26)
  2196.     
  2197.     
  2198.     DESCCRIPTION
  2199.     
  2200.     Although the C-CODER algorithm implemented in crypt() and fcrypt() is
  2201.     capable of secure data encryption, it may be compromised by a poor
  2202.     choice of encryption key. While there's no way to protect from a poor
  2203.     judgement choice, the key may be qualified using the cryptqual()
  2204.     function to verify that it contains a sufficient number of unique
  2205.     characters. For example if 6 characters are required, "xxxxxx" would
  2206.     fail while "switch" would qualify.
  2207.     
  2208.     
  2209.     EXAMPLE
  2210.     
  2211.             char *key;
  2212.     
  2213.             /* "readers" fails - only 5 unique characters           */
  2214.     
  2215.             printf("%s %s\n", "readers",
  2216.                     cryptqual("readers, 6) ? "failed" : "passed");
  2217.     
  2218.             /* "spreaders" qualifies - 6 unique characters          */
  2219.     
  2220.             printf("%s %s\n", "spreaders",
  2221.                     cryptqual("spreaders, 6) ? "failed" : "passed");
  2222.     
  2223.     
  2224.     SEE ALSO:  crypt(), crypt_install()
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245. CTLBRK.FNC - Thu 23 Nov 89 00:20 - Page 35:  
  2246.  
  2247.     NAME
  2248.     
  2249.             ctlbrk -- control-break (^C) interrupt handler
  2250.     
  2251.     
  2252.     PROTOTYPED IN:  mflsys.h
  2253.     
  2254.     
  2255.     SYNOPSIS
  2256.     
  2257.             r = ctlbrk(func);
  2258.             int *func;
  2259.             int r;       return 0 to continue program, not zero
  2260.                          to abort.
  2261.     
  2262.     
  2263.     DESCRIPTION
  2264.     
  2265.     This function is used to install a user-written interrupt handler for
  2266.     DOS int 23h, the Control-C handler.  The default handler simply exits
  2267.     (ungracefully) the host program.  Using ctlbrk(), a user-written
  2268.     handler may be substituted for the default.  This may be desirable if
  2269.     it is absolutely necessary to prevent an untimely user-inspired exit,
  2270.     or if control-C is desired to perform some function within the
  2271.     program. The parameter passed is the address of the actual function.
  2272.     Passing a NULL parameter re-installs the handler which was in the
  2273.     interrupt table before this function altered the vector address.  DOS
  2274.     re-installs the original handler upon any program exit, so it is
  2275.     unnecessary to uninstall this handler before actually exiting.
  2276.     
  2277.     
  2278.     EXAMPLE
  2279.     
  2280.            #include <stdio.h>
  2281.            #include <keys.h>
  2282.            handler()
  2283.            {    Bputs("Control-C Received!!!\n");
  2284.                 /* couldn't use puts() which calls DOS */
  2285.                 return(0);         /* continue program */
  2286.            }
  2287.     
  2288.            main()
  2289.            {  char ch;
  2290.               ctlbrk(&handler);
  2291.               ch = NULL;
  2292.               while(ch != ESC)    /* loop until ESCAPE pressed */
  2293.                  ch = getche();
  2294.               puts("Exiting program now.  Have a nice day!");
  2295.            }
  2296.     
  2297.     
  2298.     WARNING:
  2299.           Within the handler routine, keep the code simple and fast.
  2300.           DO NOT use printf() or its relatives as these will destroy
  2301.           the interrupt structure (for rather obscure reasons).
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311. CURSOR.FNC - Thu 23 Nov 89 00:20 - Page 36:  
  2312.  
  2313.     NAME
  2314.     
  2315.             cursor_style -- alter the cursor style
  2316.     
  2317.     
  2318.     PROTOTYPED IN:  mflconio.h
  2319.     
  2320.     
  2321.     SYNOPSIS
  2322.     
  2323.             void cursor_style(type, startscan, stopscan);
  2324.             int type;         type of cursor as defined below
  2325.             int startscan;    top scanline of cursor
  2326.             int stopscan;     bottom scanline of cursor
  2327.     
  2328.     
  2329.     DESCRIPTION
  2330.     
  2331.     This function allows selection of several pre-defined cursor
  2332.     styles, or user-specified cursor size.  If "type" is 0, then
  2333.     user must supply a starting scanline and stopping scanline
  2334.     value.  If "type is 1-5, then these values may be set to
  2335.     anything to simply satisfy the argument count.  Cursor
  2336.     scanlines are numbered from the top (0) to the bottom, which
  2337.     is 7 for CGA boards, and 13 for Monochrome Adapters.  The
  2338.     Predefined values are:
  2339.         type == 1      Normal underline cursor for CGA
  2340.         type == 2      same, Mono Adapter
  2341.         type == 3      Block cursor for CGA
  2342.         type == 4      same, Mono Adapter
  2343.         type == 5      Cursor becomes invisible
  2344.     
  2345.     
  2346.     EXAMPLE
  2347.     
  2348.          /* for CGA video modes: */
  2349.         cursor_style(4, 0, 0);    /* set block cursor */
  2350.         cursor_style(1, 0, 0);    /* restore underline cursor */
  2351.         cursor_style(0, 1, 7);    /* set a very large block cursor */
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377. D_CLS.FNC - Thu 23 Nov 89 00:20 - Page 37:  
  2378.  
  2379.     NAME
  2380.     
  2381.             d_cls -- clear current screen
  2382.     
  2383.     
  2384.     PROTOTYPED IN:  mflconio.h
  2385.     
  2386.     
  2387.     SYNOPSIS
  2388.     
  2389.             void d_cls();
  2390.     
  2391.     
  2392.     DESCRIPTION
  2393.     
  2394.     This function clears the screen on the current page.
  2395.     
  2396.     
  2397.     EXAMPLE
  2398.     
  2399.              d_cls();
  2400.     
  2401.     
  2402.     SEE ALSO: cls()
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443. D_POS.FNC - Thu 23 Nov 89 00:20 - Page 38:  
  2444.  
  2445.     NAME
  2446.     
  2447.             d_pos -- position the cursor on a video page
  2448.     
  2449.     
  2450.     PROTOTYPED IN:  mflconio.h
  2451.     
  2452.     
  2453.     SYNOPSIS
  2454.     
  2455.             void d_pos(r, c, p);
  2456.             int r;      row number
  2457.             int c;      column number
  2458.             int p;      video page (must match current mode)
  2459.     
  2460.     
  2461.     DESCRIPTION
  2462.     
  2463.     This function positions the cursor on the specified video
  2464.     page.  Row, column, and page values must match the current
  2465.     video mode.
  2466.     
  2467.     
  2468.     EXAMPLE
  2469.     
  2470.          d_pos(10, 15, 0);   /* position cursor on row 10, column 15,
  2471.                                 video page 0 */
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509. D_SAY.FNC - Thu 23 Nov 89 00:20 - Page 39:  
  2510.  
  2511.     NAME
  2512.     
  2513.             d_say -- display a string at a specific position
  2514.     
  2515.     
  2516.     PROTOTYPED IN:  mflconio.h
  2517.     
  2518.     
  2519.     SYNOPSIS
  2520.     
  2521.             void d_say(r, c, str);
  2522.             int r;      row number
  2523.             int c;      column number
  2524.             char *str;  character string to display
  2525.     
  2526.     
  2527.     DESCRIPTION
  2528.     
  2529.     This function positions the cursor on the specified row and column on
  2530.     video page 0, and then writes the string.
  2531.     
  2532.     
  2533.     EXAMPLE
  2534.     
  2535.             d_say(10, 15, "Hello World!\n");
  2536.     
  2537.     
  2538.     CAVEAT:  The string is written to stdout.  Therefore, the results will
  2539.              not be as advertised if stdout has been redirected from the
  2540.              default video output. Video page selection is only available
  2541.              on CGA adapters.
  2542.     
  2543.     
  2544.     SEE ALSO: d_saypag
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575. D_SAYPAG.FNC - Thu 23 Nov 89 00:20 - Page 40:  
  2576.  
  2577.     NAME
  2578.     
  2579.             d_saypag -- position cursor with page specification, the write
  2580.     
  2581.     
  2582.     PROTOTYPED IN:  mflconio.h
  2583.     
  2584.     
  2585.     SYNOPSIS
  2586.     
  2587.             void d_saypag(r, c, str, p);
  2588.             int r;      row number
  2589.             int c;      column number
  2590.             char *str;  character string to display
  2591.             int p;      video page (must match current mode)
  2592.     
  2593.     
  2594.     DESCRIPTION
  2595.     
  2596.     This function positions the cursor on the specified row and column on
  2597.     video page 0, and then writes the string. The d_saypag function also
  2598.     selects the video page on which to place the cursor.
  2599.     
  2600.     
  2601.     EXAMPLE
  2602.     
  2603.             d_saypag(5, 20, "Goodby!", 1);
  2604.     
  2605.     
  2606.     
  2607.     CAVEAT:  The string is written to stdout.  Therefore, the results will
  2608.              not be as advertised if stdout has been redirected from the
  2609.              default video output. Video page selection is only available
  2610.              on CGA adapters.
  2611.     
  2612.     
  2613.     SEE ALSO: d_say()
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641. DAYNUM.FNC - Thu 23 Nov 89 00:20 - Page 41:  
  2642.  
  2643.     NAME
  2644.     
  2645.             daynum -- find the number of a date within a year
  2646.     
  2647.     
  2648.     PROTOTYPED IN:  mfltime.h
  2649.     
  2650.     
  2651.     SYNOPSIS
  2652.     
  2653.             value = daynum(month, day, year);
  2654.             int value;      number 1-366
  2655.             int month;      month number 1-12
  2656.             int day;        date of the month 1-31
  2657.             int year;       year, starting at 1980
  2658.     
  2659.     
  2660.     DESCRIPTION
  2661.     
  2662.     This function returns the day number, 1-366, for the given
  2663.     date.  By itself, this is not very useful, but the function is
  2664.     used as an intermediate calculation in certain other date routines.
  2665.     Years below 1980 are ignored.  The year value is used to determine
  2666.     status as leap year.
  2667.     
  2668.     
  2669.     EXAMPLE
  2670.     
  2671.            for July 2, 1986:
  2672.     
  2673.            int value;
  2674.            value = daynum(7, 2, 1986);
  2675.     
  2676.     
  2677.     SEE ALSO: julian_to_yrday()
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707. DEBOUNCE.FNC - Thu 23 Nov 89 00:20 - Page 42:  
  2708.  
  2709.     NAME
  2710.     
  2711.             debounce() -- input debouncer
  2712.     
  2713.     
  2714.     PROTOTYPED IN:  mflsys.h
  2715.     
  2716.     
  2717.     SYNOPSIS
  2718.     
  2719.             (void)debounce();         input debouncer
  2720.     
  2721.     
  2722.     DESCRIPTION
  2723.     
  2724.     This function is part of a series of functions used to read and
  2725.     debounce the four switch inputs on the joystick input port.  The
  2726.     analog joystick inputs are not supported. debounce() must be called
  2727.     periodically in order to debounce and process the switch inputs.  It
  2728.     is suggested that debounce() be called about 75 to 100 times per
  2729.     second. The structure "gamesw" contains information used by these
  2730.     routines.  The number of times debounce must be invoked to return a
  2731.     valid input is contained in gamesw.seed, and may be altered as
  2732.     desired.
  2733.     
  2734.     Switch values are returned as an 8 bit value, with only the lowest 4
  2735.     bits in use.  A set bit indicates a closed switch. If multiple
  2736.     keystrokes are not allowed, then get_press() will return 0, 1, 2, 4,
  2737.     or 8.  If multiples are allowed, then all values 0-15 (0-0x0f) may be
  2738.     returned.
  2739.     
  2740.           bit position            pin number on connector
  2741.               0                            2
  2742.               1                            7
  2743.               2                            14
  2744.               3                            10
  2745.     
  2746.     
  2747.     EXAMPLE
  2748.     
  2749.             main() {
  2750.             unsigned char i;
  2751.             init_game(FALSE);    /* allow only single switch inputs */
  2752.             for ever() {
  2753.                   debounce();       /* call this regularly */
  2754.                   i = get_press();
  2755.                   if(i is 0) continue;
  2756.                   printf("switch value is %x\n", i);
  2757.                   }
  2758.             }
  2759.     
  2760.     
  2761.     SEE ALSO: init_game(), clear_game(), get_press()
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773. DELFILES.FNC - Thu 23 Nov 89 00:20 - Page 43:  
  2774.  
  2775.     NAME
  2776.     
  2777.             del_files -- delete files using FCB functions
  2778.     
  2779.     
  2780.     PROTOTYPED IN:  mflfiles.h
  2781.     
  2782.     
  2783.     SYNOPSIS
  2784.     
  2785.             r = del_files(dir,mask);
  2786.             int r;          ERROR if directory could not be located, else
  2787.                             SUCCESS
  2788.             char *dir;      directory where files are located
  2789.             char *mask;     filename mask
  2790.     
  2791.     
  2792.     DESCRIPTION
  2793.     
  2794.     Using standard C functions such as find first/next and unlink() to delete
  2795.     multiple files is dramatically slower than when COMMAND.COM does it. It
  2796.     turns out that the speed advantage is due to the use of the FCB delete
  2797.     call which can accept wildcards. The del_files() function works the same
  2798.     way as COMMAND.COM and can wipe out whole directories full of files in a
  2799.     flash.
  2800.     
  2801.     
  2802.     EXAMPLE
  2803.     
  2804.             char *path="C:\PATH\BRANCH", *mask="*.BAK";
  2805.             if (ERROR == delfiles(path,mask))
  2806.                     printf("Couldn't find %s\n", path);
  2807.             else    printf("Files matching %s in %s deleted\n", mask, path);
  2808.     
  2809.     
  2810.     SEE ALSO: unlink()
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839. DIRMASK.FNC - Thu 23 Nov 89 00:20 - Page 44:  
  2840.  
  2841.     NAME
  2842.     
  2843.             dirmask  -- vaidate directory entry w/ name and attribute masks
  2844.     
  2845.     
  2846.     PROTOTYPED IN:  mflfiles.h
  2847.     
  2848.     
  2849.     SYNOPSIS
  2850.     
  2851.             r = dirmask(ffblk, y_mask, n_mask, y_atr, n_atr);
  2852.             int r;                  SUCCESS if entry validated, else ERROR
  2853.             struct FIND *ffblk;     directory entry to validate
  2854.             char *y_mask;           name inclusion mask - validate if this
  2855.                                     name matches the entry's - NULL matches
  2856.                                     all
  2857.             char *n_mask;           name exclusion mask - validate if this
  2858.                                     name does not matches the entry's - NULL
  2859.                                     matches none
  2860.             unsigned y_atr;         attribute inclusion mask - FA_ANY
  2861.                                     matches all
  2862.             unsigned n_atr;         attribute exclusion mask - 0 matches
  2863.                                     none
  2864.     
  2865.     
  2866.     DESCRIPTION
  2867.     
  2868.     The dos_findfirst/next functions provide no convenient way to do
  2869.     exclusion searches or to validate file attributes. For example if you
  2870.     try looking for directories using findfirst and an attribute of
  2871.     FA_DIREC, you'll soon find that DOS returns all directories PLUS all
  2872.     normal files. The dirmask() function operates on a FIND structure to
  2873.     validate its name and attribute members.
  2874.     
  2875.     The first parameter is a file spec which must match for the directory
  2876.     entry to be validated. The second is a file spec which will prevent
  2877.     validation. The third parameter is an attribute mask which must match
  2878.     the entry's attributes for validation. The fourth is an attribute mask
  2879.     which will prevent validation. Specifying NULL for either of the name
  2880.     specs will cause the corresponding validation to be skipped. Specifying
  2881.     FA_ANY for the inclusion attribute will match all entries. Specifying 0
  2882.     for the exclusion attribute will cause no entries to be rejected.
  2883.     
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905. DIRMASK.FNC - Thu 23 Nov 89 00:20 - Page 45:  
  2906.  
  2907.  
  2908.     EXAMPLE
  2909.     
  2910.             DOS_DIR *dirp;
  2911.             struct FIND *ffblk;
  2912.     
  2913.             /* print all non-.OBJ files beginning with 'A'...
  2914.                ...with the archive bit set which aren't directories */
  2915.     
  2916.             dirp = opendir(fname);
  2917.             do
  2918.             {   if (NULL != (ffblk = readdir(dirp)))
  2919.                 {   if (SUCCESS == dirmask(ffblk, "A.*", "*.OBJ",
  2920.                         FA_ARCH ,FA_DIREC);
  2921.                             printf("%3d - %s\n", dirp->dd_loc, ffblk->name);
  2922.                 }
  2923.             } while (ffblk);
  2924.             puts("EOF\n");
  2925.             closedir(dirp);
  2926.     
  2927.     
  2928.     SEE ALSO:  wildname(), opendir(), readdir() closedir(), rfind_1st(),
  2929.                rfind_nxt()
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971. DRVALID.FNC - Thu 23 Nov 89 00:20 - Page 46:  
  2972.  
  2973.     NAME
  2974.     
  2975.             drvalid -- see if a drive is valid
  2976.     
  2977.     
  2978.     PROTOTYPED IN:  mflfiles.h
  2979.     
  2980.     
  2981.     SYNOPSIS
  2982.     
  2983.              r = drvalid(drive);
  2984.              int r;          returns TRUE if valid, else FALSE
  2985.              char drive;     drive ('A' - 'Z') to check
  2986.     
  2987.     
  2988.     DESCRIPTION
  2989.     
  2990.     Drvalid() tests if a specified drive is valid. FALSE will be returned
  2991.     for non-existent drives or for a floppy drive with the door open or
  2992.     with an unformatted diskette. This function works by attempting to do
  2993.     an absolute disk read of sector zero and avoids the DOS critical error
  2994.     (ABORT, RETRY, etc.) handler.
  2995.     
  2996.     Note that the drive specification passed to drvalid() may be either
  2997.     upper or lower case.
  2998.     
  2999.     
  3000.     EXAMPLE
  3001.     
  3002.             char drive;
  3003.     
  3004.             if(drvalid('a')) puts("Drive valid!");
  3005.             else puts("Drive not currently valid!");
  3006.     
  3007.     
  3008.     SEE ALSO: getdrv, chdrv
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037. DSTR_I.FNC - Thu 23 Nov 89 00:20 - Page 47:  
  3038.  
  3039.     NAME
  3040.     
  3041.             dstr_i -- make an ascii decimal string into an integer
  3042.     
  3043.     
  3044.     PROTOTYPED IN:  mflstrng.h
  3045.     
  3046.     
  3047.     SYNOPSIS
  3048.     
  3049.             c = dstr_i(p, r);
  3050.             char *p;
  3051.             int *r;
  3052.             int c;
  3053.     
  3054.     
  3055.     DESCRIPTION
  3056.     
  3057.     Read a string of ascii decimal digits and create an integer
  3058.     from the result.  String must begin with a digit, +, or -.
  3059.     Calculation proceeds to first non-ascii digit or NULL terminator.
  3060.     Count of actual digits read is returned, and integer is placed
  3061.     in specified destination.  '-' sign as first character returns
  3062.     integer negated.
  3063.     
  3064.     
  3065.     EXAMPLE
  3066.     
  3067.            char string[] = "1357";
  3068.            int result;
  3069.            int count;
  3070.            count = dstr_i(string, &result);
  3071.     
  3072.              /* count will equal 4
  3073.              result will equal 1357 */
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103. DV_ATTR.FNC - Thu 23 Nov 89 00:20 - Page 48:  
  3104.  
  3105.     NAME
  3106.     
  3107.            dvid_attrib --  set direct video attribute (color)
  3108.     
  3109.     
  3110.     PROTOTYPED IN:  mflconio.h
  3111.     
  3112.     
  3113.     SYNOPSIS
  3114.     
  3115.            dvid_attrib(attrib);
  3116.            int attrib;              video attribute to set
  3117.     
  3118.     
  3119.     DESCRIPTION
  3120.     
  3121.     The dvid_attrib() function sets the video attribute used for subsequent
  3122.     memory writes.  The direct video access functions are described in some
  3123.     detail in the users manual accompanying the MicroFirm Function Library.
  3124.     They are only briefly reviewed here.  Be sure to look at the utility
  3125.     file "dump.c" for examples of function usage.
  3126.     
  3127.     
  3128.     SEE ALSO:  dvid_getattr()
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169. DV_BIOS.FNC - Thu 23 Nov 89 00:20 - Page 49:  
  3170.  
  3171.     NAME
  3172.     
  3173.            dvid_bios() -- force use of bios routines
  3174.     
  3175.     
  3176.     PROTOTYPED IN:  mflconio.h
  3177.     
  3178.     
  3179.     SYNOPSIS
  3180.     
  3181.            dvid_bios(void);             
  3182.     
  3183.     
  3184.     DESCRIPTION
  3185.     
  3186.     The dvid_bios() function may be called to force use of ROM BIOS services
  3187.     if problems are encountered using memory access.  The direct video
  3188.     access functions are described in some detail in the users manual
  3189.     accompanying the MicroFirm Function Library.  They are only briefly
  3190.     reviewed here.  Be sure to look at the utility file "dump.c" for
  3191.     examples of function usage.
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235. DV_BOX.FNC - Thu 23 Nov 89 00:20 - Page 50:  
  3236.  
  3237.     NAME
  3238.     
  3239.             dvid_box -- display a box on the screen
  3240.     
  3241.     
  3242.     PROTOTYPED IN:  mflconio.h
  3243.     
  3244.     
  3245.     SYNOPSIS
  3246.     
  3247.             void dvid_box(row, col, width, height, style);
  3248.             int row, col;       position to display upper left corner
  3249.             int height, width;  size of box
  3250.             int style;          0 = single line, 1 = double line,
  3251.                                 2 = single line reverse video,
  3252.                                 3 = double line reverse video
  3253.     
  3254.     
  3255.     DESCRIPTION
  3256.     
  3257.     This function uses the features of the MicroFirm Function Library
  3258.     display package functions, and must therefore follow the rules laid
  3259.     down for their use.  Specifically, disp_init() must be called prior to
  3260.     using this function, and the functions may fail of the target system is
  3261.     not a very close compatible since direct memory writing is being used.
  3262.     dvid_box places a single line or double line box on the screen with the
  3263.     upper left corner anchored at "row" and "column", with the size denoted
  3264.     by the "height" and "width" values. No error checking is done on any
  3265.     value.  Invalid values may have unpredictable results.
  3266.     
  3267.     
  3268.     EXAMPLE
  3269.     
  3270.           int i;
  3271.           dvid_init();    /* initialize the package */
  3272.           dvid_cls();     /* clear the screen */
  3273.           dvid_box(0, 0, 80, 24, 1); /* border the entire screen */
  3274.                                      /* with double graphics line */
  3275.     
  3276.     
  3277.     
  3278.     CAVEAT:
  3279.     
  3280.     if a color attribute has been set before this call,
  3281.     it will revert to black & white if the "reverse video"
  3282.     outlines are selected.  The attribute is not changed
  3283.     for the normal video border selections.
  3284.     
  3285.     
  3286.     SEE ALSO: mkbox()
  3287.     
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301. DV_CATR.FNC - Thu 23 Nov 89 00:20 - Page 51:  
  3302.  
  3303.     NAME
  3304.     
  3305.             dvid_char_atr -- dvid_char_at, returns cursor to start
  3306.     
  3307.     
  3308.     PROTOTYPED IN:  mflconio.h
  3309.     
  3310.     
  3311.     SYNOPSIS
  3312.     
  3313.             void dvid_char_atr(row, col, char);
  3314.             int row, col;     position to display
  3315.             char *string;     string to display
  3316.             char ch;          character to display
  3317.     
  3318.     
  3319.     DESCRIPTION
  3320.     
  3321.     This function uses the features of the MicroFirm Function Library's
  3322.     display package functions, and therefore, must follow the rules laid
  3323.     down for their use.  Specifically, dvid_init() must be called prior to
  3324.     using this function, and the function may fail if the target system is
  3325.     not a very close compatible since direct memory writing is being used.
  3326.     dvid_char_atr() read the current real cursor position and perform a
  3327.     dvid_move() after writing the specified data.  Before using this call,
  3328.     be sure the display package cursor position and the screen position are
  3329.     equal by doing a dvid_flush() call.
  3330.     
  3331.     
  3332.     EXAMPLE
  3333.     
  3334.             int i;
  3335.             dvid_init();    /* initialize the package */
  3336.             dvid_cls();     /* clear the screen */
  3337.             dvid_say(0, 0, "Hello");  /* write to upper left corner */
  3338.             for(i = 0; i < 10; i++) {
  3339.                  dvid_char_at(i, i+1, i | '0');  /* write a sequence */
  3340.             }
  3341.             dvid_move(12, 40);   /* move to center of screen */
  3342.             dvid_flush();        /* physically update screen cursor */
  3343.             dvid_sayr(20, 70, "Goodby");  /* write into lower corner */
  3344.             dvid_putchr('!');    /* this char should be at 12, 40 */
  3345.     
  3346.     
  3347.     SEE ALSO: dvid_say(), dvid_sayr(), dvid_char_at()
  3348.     
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367. DV_CHAT.FNC - Thu 23 Nov 89 00:20 - Page 52:  
  3368.  
  3369.     NAME
  3370.     
  3371.             dvid_char_at -- display character at specified position
  3372.     
  3373.     
  3374.     PROTOTYPED IN:  mflconio.h
  3375.     
  3376.     
  3377.     SYNOPSIS
  3378.     
  3379.             void dvid_char_at(row, col, ch);
  3380.             int row, col;     position to display
  3381.             char *string;     string to display
  3382.             char ch;          character to display
  3383.     
  3384.     
  3385.     DESCRIPTION
  3386.     
  3387.     This function uses the features of the MicroFirm Funtion Library's
  3388.     display package functions, and must therefore follow the rules laid down
  3389.     for their use.  Specifically, dvid_init() must be called prior to using
  3390.     this function, and the function may fail if the target system is not a
  3391.     very close compatible since direct memory writing is being used.
  3392.     dvid_char_at() passes only a carriage return, linefeed, backspace, tab,
  3393.     and bell control code.  All other control codes are ignored.  Before
  3394.     using this call, be sure the display package cursor position and the
  3395.     screen position are equal by doing a dvid_flush() call.  dvid_char_at()
  3396.     performs the dvid_flush() call before returning, thereby insuring cursor
  3397.     updating.
  3398.     
  3399.     
  3400.     EXAMPLE
  3401.     
  3402.             int i;
  3403.             dvid_init();    /* initialize the package */
  3404.             dvid_cls();     /* clear the screen */
  3405.             dvid_say(0, 0, "Hello");  /* write to upper left corner */
  3406.             for(i = 0; i < 10; i++) {
  3407.                  dvid_char_at(i, i+1, i | '0');  /* write a sequence */
  3408.             }
  3409.             dvid_move(12, 40);   /* move to center of screen */
  3410.             dvid_flush();        /* physically update screen cursor */
  3411.             dvid_sayr(20, 70, "Goodby");  /* write into lower corner */
  3412.             dvid_putchr('!');    /* this char should be at 12, 40 */
  3413.     
  3414.     
  3415.     SEE ALSO: dvid_say(), dvid_sayr(), dvid_char_atr()
  3416.     
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433. DV_CHATR.FNC - Thu 23 Nov 89 00:20 - Page 53:  
  3434.  
  3435.     NAME
  3436.     
  3437.            dvid_chgattrib -- alter attribute in an area
  3438.     
  3439.     
  3440.     PROTOTYPED IN:  mflconio.h
  3441.     
  3442.     
  3443.     SYNOPSIS
  3444.     
  3445.            dvid_chgattrib(srow, scol, erow, ecol, attrib);
  3446.            int srow;               starting row number
  3447.            int scol;               starting column number
  3448.            int row;                absolute row number
  3449.            int ecol;               ending column number
  3450.            int attrib;             video attribute
  3451.     
  3452.     
  3453.     DESCRIPTION
  3454.     
  3455.     The dvid_chgattrib() function may be used to alter the attributes on a
  3456.     region of the screen starting at row (srow) and column (scol), up to and
  3457.     including (erow) and (ecol), to the new (attribute).  This provides a
  3458.     means of changing the color of a region of the screen from 1 character
  3459.     to the full screen without altering the character data in memory.  The
  3460.     direct video access functions are described in some detail in the users
  3461.     manual accompanying the MicroFirm Function Library.  They are only
  3462.     briefly reviewed here.  Be sure to look at the utility file "dump.c" for
  3463.     examples of function usage.
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499. DV_CLFLD.FNC - Thu 23 Nov 89 00:20 - Page 54:  
  3500.  
  3501.     NAME
  3502.     
  3503.             dvid_clrfield -- clear a screen field
  3504.     
  3505.     
  3506.     PROTOTYPED IN:  mflconio.h
  3507.     
  3508.     
  3509.     SYNOPSIS
  3510.     
  3511.             void dvid_clrfield(row, col, size);
  3512.             int row, col;    starting point
  3513.             int size;        number of columns to clear ( <= 80)
  3514.             int page;        video page number
  3515.                              (for non-CGA, specify 0)
  3516.     
  3517.     
  3518.     DESCRIPTION
  3519.     
  3520.     This function handles the problem of clearing a section of a line on
  3521.     the screen without clearing to the end of the line. dvid_clrfield()
  3522.     will use the current screen attribute. The field is cleared to ASCII
  3523.     spaces. If the size parameter is larger than 80, it is forced to 80.
  3524.     
  3525.     
  3526.     EXAMPLE
  3527.     
  3528.             dvid_clrfield(10, 20, 15, 0);  /* clear 15 columns on page 0
  3529.                                               starting at row 10, column 20 */
  3530.     
  3531.     
  3532.     SEE ALSO: dvid_cls()
  3533.     
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565. DV_CLS.FNC - Thu 23 Nov 89 00:20 - Page 55:  
  3566.  
  3567.     NAME
  3568.     
  3569.             dvid_cls -- clear the display and home cursor
  3570.     
  3571.     
  3572.     PROTOTYPED IN:  mflconio.h
  3573.     
  3574.     
  3575.     SYNOPSIS
  3576.     
  3577.             void dvid_cls();
  3578.     
  3579.     
  3580.     DESCRIPTION
  3581.     
  3582.     This function uses the features of the MicroFirm Funtion Library's
  3583.     display package functions, and must therefore follow the rules laid down
  3584.     for their use.  Specifically, dvid_init() must be called prior to using
  3585.     this function, and the function may fail if the target system is not a
  3586.     very close compatible since direct memory writing is being used.
  3587.     dvid_cls() will clear the screen.
  3588.     
  3589.     
  3590.     EXAMPLE
  3591.     
  3592.             int i;
  3593.             dvid_init();    /* initialize the package */
  3594.             dvid_cls();     /* clear the screen */
  3595.             dvid_say(0, 0, "Hello");  /* write to upper left corner */
  3596.             for(i = 0; i < 10; i++) {
  3597.                 dvid_char_at(i, i+1, i | '0');  /* write a sequence */
  3598.             }
  3599.             dvid_move(12, 40);   /* move to center of screen */
  3600.             dvid_flush();        /* physically update screen cursor */
  3601.             dvid_sayr(20, 70, "Goodby");  /* write into lower corner */
  3602.             dvid_putchr('!');    /* this char should be at 12, 40 */
  3603.     
  3604.     
  3605.     SEE ALSO: dvid_clrfield(), d_cls()
  3606.     
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631. DV_DONE.FNC - Thu 23 Nov 89 00:20 - Page 56:  
  3632.  
  3633.     NAME
  3634.     
  3635.            dvid_done -- de-initialize the functions
  3636.     
  3637.     
  3638.     PROTOTYPED IN:  mflconio.h
  3639.     
  3640.     
  3641.     SYNOPSIS
  3642.     
  3643.            dvid_done(void);             
  3644.     
  3645.     
  3646.     DESCRIPTION
  3647.     
  3648.     The dvid_done() function is called before exiting a program to restore
  3649.     screen characteristics.  It may also be used from within a program to
  3650.     restore all default values within the direct video package.  The direct
  3651.     video access functions are described in some detail in the users manual
  3652.     accompanying the MicroFirm Function Library.  They are only briefly
  3653.     reviewed here.  Be sure to look at the utility file "dump.c" for
  3654.     examples of function usage.
  3655.     
  3656.     
  3657.     SEE ALSO:  dvid_init()
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697. DV_EEOL.FNC - Thu 23 Nov 89 00:20 - Page 57:  
  3698.  
  3699.     NAME
  3700.     
  3701.            dvid_e2eol -- erase from cursor to end of line
  3702.     
  3703.     
  3704.     PROTOTYPED IN:  mflconio.h
  3705.     
  3706.     
  3707.     SYNOPSIS
  3708.     
  3709.            dvid_e2eol(void);            
  3710.     
  3711.     
  3712.     DESCRIPTION
  3713.     
  3714.     The dvid_e2eol() function is used to erase (to spaces) the screen from
  3715.     the current internal cursor position to the end of the line e2eol.  The
  3716.     direct video access functions are described in some detail in the users
  3717.     manual accompanying the MicroFirm Function Library.  They are only
  3718.     briefly reviewed here.  Be sure to look at the utility file "dump.c" for
  3719.     examples of function usage.
  3720.     
  3721.     
  3722.     SEE ALSO:  dvid_e2eos()
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763. DV_EEOS.FNC - Thu 23 Nov 89 00:20 - Page 58:  
  3764.  
  3765.     NAME
  3766.     
  3767.            dvid_e2eos -- erase cursor to end of screen
  3768.     
  3769.     
  3770.     PROTOTYPED IN:  mflconio.h
  3771.     
  3772.     
  3773.     SYNOPSIS
  3774.     
  3775.            dvid_e2eos(void);            
  3776.     
  3777.     
  3778.     DESCRIPTION
  3779.     
  3780.     The dvid_e2eos() function is used to erase (to spaces) the screen from
  3781.     the current internal cursor position to the end of the current video
  3782.     page.  The direct video access functions are described in some detail in
  3783.     the users manual accompanying the MicroFirm Function Library.  They are
  3784.     only briefly reviewed here.  Be sure to look at the utility file
  3785.     "dump.c" for examples of function usage.
  3786.     
  3787.     
  3788.     SEE ALSO:  dvid_e2eol()
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829. DV_FLUSH.FNC - Thu 23 Nov 89 00:20 - Page 59:  
  3830.  
  3831.     NAME
  3832.     
  3833.            dvid_flush -- update real cursor position
  3834.     
  3835.     
  3836.     PROTOTYPED IN:  mflconio.h
  3837.     
  3838.     
  3839.     SYNOPSIS
  3840.     
  3841.            dvid_flush(void);            
  3842.     
  3843.     
  3844.     DESCRIPTION
  3845.     
  3846.     The dvid_flush() function is called to force the onscreen cursor to the
  3847.     position defined by the "internal" cursor position.  During video
  3848.     writes, an internal cursor position is maintained, but the onscreen
  3849.     cursor is NOT automatically updated to reflect the current writing
  3850.     position.  This function resolves the discrepancy.  The direct video
  3851.     access functions are described in some detail in the users manual
  3852.     accompanying the MicroFirm Function Library.  They are only briefly
  3853.     reviewed here.  Be sure to look at the utility file "dump.c" for
  3854.     examples of function usage.
  3855.     
  3856.     
  3857.     SEE ALSO:  dvid_move()
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895. DV_GTATR.FNC - Thu 23 Nov 89 00:20 - Page 60:  
  3896.  
  3897.     NAME
  3898.     
  3899.            dvid_getattr -- fetch the current attribute
  3900.     
  3901.     
  3902.     PROTOTYPED IN:  mflconio.h
  3903.     
  3904.     
  3905.     SYNOPSIS
  3906.     
  3907.            attrib = dvid_getattr(void);     
  3908.            int attrib;             video attribute
  3909.     
  3910.     
  3911.     DESCRIPTION
  3912.     
  3913.     The dvid_getattr() function is used to return the current attribute used
  3914.     for writing. It will return the value previously set with dvid_attrib().
  3915.     The direct video access functions are described in some detail in the
  3916.     users manual accompanying the MicroFirm Function Library.  They are only
  3917.     briefly reviewed here.  Be sure to look at the utility file "dump.c" for
  3918.     examples of function usage.
  3919.     
  3920.     
  3921.     SEE ALSO:  dvid_attrib()
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961. DV_GTMOD.FNC - Thu 23 Nov 89 00:20 - Page 61:  
  3962.  
  3963.     NAME
  3964.     
  3965.             dvid_getmode -- gets the current translation mode
  3966.     
  3967.     
  3968.     PROTOTYPED IN:  mflconio.h
  3969.     
  3970.     
  3971.     SYNOPSIS
  3972.     
  3973.             r = dvid_getmode();
  3974.             int r;          current translation mode (raw = TRUE)
  3975.     
  3976.     
  3977.     DESCRIPTION
  3978.     
  3979.     The dvid_getmode() function retrieves the current control character
  3980.     translation mode.  The direct video access functions are described in
  3981.     some detail in the users manual accompanying the MicroFirm Function
  3982.     Library.  They are only briefly reviewed here.  Be sure to look at the
  3983.     utility file "dump.c" for examples of function usage.
  3984.     
  3985.     
  3986.     SEE ALSO: dvid_raw()
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027. DV_INIT.FNC - Thu 23 Nov 89 00:20 - Page 62:  
  4028.  
  4029.     NAME
  4030.     
  4031.            dvid_init -- initialize the direct video functions
  4032.     
  4033.     
  4034.     PROTOTYPED IN:  mflconio.h
  4035.     
  4036.     
  4037.     SYNOPSIS
  4038.     
  4039.            dvid_init(void);
  4040.     
  4041.     
  4042.     DESCRIPTION
  4043.     
  4044.     The dvid_init() function MUST be called before any other dvid* functions
  4045.     are used.  This function discovers the type of video card and mode in
  4046.     use and sets internal variables accordingly.  The direct video access
  4047.     functions are described in some detail in the users manual accompanying
  4048.     the MicroFirm Function Library.  They are only briefly reviewed here.
  4049.     Be sure to look at the utility file "dump.c" for examples of function
  4050.     usage.
  4051.     
  4052.     
  4053.     SEE ALSO:  dvid_done()
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093. DV_MOVE.FNC - Thu 23 Nov 89 00:20 - Page 63:  
  4094.  
  4095.     NAME
  4096.     
  4097.            dvid_move -- set internal cursor position
  4098.     
  4099.     
  4100.     PROTOTYPED IN:  mflconio.h
  4101.     
  4102.     
  4103.     SYNOPSIS
  4104.     
  4105.            dvid_move(row, col);     
  4106.            int row;                absolute row number
  4107.            int col;                absolute column number
  4108.     
  4109.     
  4110.     DESCRIPTION
  4111.     
  4112.     The dvid_move() function sets the "internal" cursor to the specified
  4113.     (row) and (col) positions.  Subsequent writes to the screen will begin
  4114.     at this position.  The direct video access functions are described in
  4115.     some detail in the users manual accompanying the MicroFirm Function
  4116.     Library.  They are only briefly reviewed here.  Be sure to look at the
  4117.     utility file "dump.c" for examples of function usage.
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159. DV_NTERD.FNC - Thu 23 Nov 89 00:20 - Page 64:  
  4160.  
  4161.     NAME
  4162.     
  4163.             dvid_enterdata -- enter a string of data from keyboard
  4164.     
  4165.     
  4166.     PROTOTYPED IN:  mflconio.h
  4167.     
  4168.     
  4169.     SYNOPSIS
  4170.     
  4171.              r = dvid_enterdata(dest, qty, row, col, mode);
  4172.              int r;          returns TRUE or FALSE
  4173.              char *dest;     destination for string
  4174.              int qty;        maximum allowable chars + 1
  4175.              int row, col;   row and column of string start*
  4176.              int mode;       mode for character checking
  4177.     
  4178.     
  4179.     DESCRIPTION
  4180.     
  4181.     This function provides a convenient method for entering character
  4182.     strings from the keyboard and verifying the character syntax.  Line
  4183.     editing is supported to enhance user input.  Entry is as follows:
  4184.     
  4185.         Carriage Return terminates input and returns TRUE.
  4186.             If no other data was entered, destination string
  4187.             is NULLed in the first position. CR is not placed
  4188.             into destination.
  4189.         ESCape terminates entry at once, NULLs destination,
  4190.                clears screen field, and returns FALSE.
  4191.         HOME clears field, and restarts entry without returning.
  4192.         BACKSPACE and Cursor Left will destructively backspace
  4193.                up to beginning of field.
  4194.         Only qty - 1 characters will be accepted.
  4195.         Any error sounds console BELL.
  4196.         Various modes allow for checking of syntax and mapping
  4197.         of characters:
  4198.                Mode 0:   allow any printable character (ASCII 20H - 7FH)
  4199.                Mode 1:   allow only alphabetics (A-Z, a-z)
  4200.                Mode 2:   allow alphabetics and numerals only
  4201.                Mode 3:   allow numerials only
  4202.                Mode 4:   allow hexadecimal characters only (0-9, A-F, a-f)
  4203.         Modes 0, 1, and 2 will map lower case to upper case if
  4204.                decimal 128 (80H) is OR'd with the mode.
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225. DV_NTERD.FNC - Thu 23 Nov 89 00:20 - Page 65:  
  4226.  
  4227.  
  4228.     EXAMPLE
  4229.     
  4230.             char string[31];
  4231.             unsigned int num;
  4232.     
  4233.             d_pos(10, 20, 0);      /* cursor to row 10, column 20 */
  4234.             fputs("Enter an alphabetic string: ", stdout);
  4235.             if(!dvid_enterdata(string, 31, 10, 48, 1)) {
  4236.             fputs("\nESCape was pressed");
  4237.             }
  4238.             else printf("\nString entered is %s\n", string);
  4239.     
  4240.                fputs("Enter hex value at current cursor position: ", stdout);
  4241.                if(!dvid_enterdata(string, 5, -1, 0, 4)) {
  4242.                   fputs("\nESCape was pressed");
  4243.                   }
  4244.                else {
  4245.                   num = atoi(string);
  4246.                   printf("Number entered was %4x", num);
  4247.                   }
  4248.     
  4249.     
  4250.     SEE ALSO: dvid_enterfn(), enterdata()
  4251.     
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291. DV_NTERF.FNC - Thu 23 Nov 89 00:20 - Page 66:  
  4292.  
  4293.     NAME
  4294.     
  4295.             dvid_enterfn -- enter a filename from keyboard
  4296.     
  4297.     
  4298.     PROTOTYPED IN:  mflconio.h
  4299.     
  4300.     
  4301.     SYNOPSIS
  4302.     
  4303.             void dvid_enterfn(dest, qty, row, col, allow);
  4304.             char *dest;     destination for string
  4305.             int qty;        maximum allowable chars + 1
  4306.             int row, col;   row and column of string start*
  4307.             int allow;      TRUE to allow entension entry
  4308.     
  4309.     
  4310.     DESCRIPTION
  4311.     
  4312.     This function provides a convenient method for entering a path and
  4313.     filename from the keyboard and verifying the character syntax.  Line
  4314.     editing is supported to enhance user input.  Entry is as follows:
  4315.     
  4316.             Carriage Return terminates input.
  4317.               If no other data was entered, destination string
  4318.               is NULLed in the first position. CR is not placed
  4319.               into destination.
  4320.             ESCape terminates entry at once, NULLs destination,
  4321.               and clears screen field.
  4322.             HOME clears field, and restarts entry without returning.
  4323.             BACKSPACE and Cursor Left will destructively backspace
  4324.               up to beginning of field.
  4325.             Only qty - 1 characters will be accepted.
  4326.             Any error sounds console BELL.
  4327.             If "allow" is TRUE, then a filename extension may be
  4328.               entered.  Otherwise, no extension may be entered, since
  4329.               the period character will be disallowed.
  4330.             A drive may be specified; the colon is only allowed in the
  4331.               second character string position.
  4332.     
  4333.     
  4334.     EXAMPLE
  4335.     
  4336.             char string[31];
  4337.     
  4338.             d_pos(10, 20, 0);      /* cursor to row 10, column 20 */
  4339.             fputs("Enter a filename: ", stdout);
  4340.             dvid_enterfn(string, 31, 10, 38, TRUE));
  4341.     
  4342.             fputs("Enter filename at current cursor position: ", stdout);
  4343.             dvid_enterfn(string, 31, -1, 0, FALSE);
  4344.     
  4345.     
  4346.     SEE ALSO: dvid_enterdata(), enterfn()
  4347.     
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357. DV_PRNTF.FNC - Thu 23 Nov 89 00:20 - Page 67:  
  4358.  
  4359.     NAME
  4360.     
  4361.            dvid_printf -- write a formatted string to screen
  4362.     
  4363.     
  4364.     PROTOTYPED IN:  mflconio.h
  4365.     
  4366.     
  4367.     SYNOPSIS
  4368.     
  4369.            r = dvid_printf(str, ...);
  4370.            int r;                  number of characters written
  4371.            char *str;              format string
  4372.            char ch;                8 bit character value
  4373.     
  4374.     
  4375.     DESCRIPTION
  4376.     
  4377.     The dvid_printf() function formats a string at the current internal
  4378.     cursor position.  This may not be the visible cursor position, since the
  4379.     visible cursor is updated to the internal cursor only with the
  4380.     dvid_flush() function.  Its syntax is identical to the familiar library
  4381.     printf() function.  The direct video access functions are described in
  4382.     some detail in the users manual accompanying the MicroFirm Function
  4383.     Library.  They are only briefly reviewed here.  Be sure to look at the
  4384.     utility file "dump.c" for examples of function usage.
  4385.     
  4386.     
  4387.     SEE ALSO:  dvid_printfa(), dvid_putstr()
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423. DV_PRTFA.FNC - Thu 23 Nov 89 00:20 - Page 68:  
  4424.  
  4425.     NAME
  4426.     
  4427.            dvid_printfa -- write formatted string to screen w/ attribute
  4428.     
  4429.     
  4430.     PROTOTYPED IN:  mflconio.h
  4431.     
  4432.     
  4433.     SYNOPSIS
  4434.     
  4435.            r = dvid_printfa(attrib, str, ...);
  4436.            int r;                  number of characters written
  4437.            int attrib;             video attribute (color)
  4438.            char *str;              format string
  4439.            char ch;                8 bit character value
  4440.     
  4441.     
  4442.     DESCRIPTION
  4443.     
  4444.     The dvid_printfa() function formats a string at the current internal
  4445.     cursor position using the specified video attribute.  This may not be
  4446.     the visible cursor position, since the visible cursor is updated to the
  4447.     internal cursor only with the dvid_flush() function.  Its syntax is
  4448.     identical to the familiar library printf() function.  The direct video
  4449.     access functions are described in some detail in the users manual
  4450.     accompanying the MicroFirm Function Library.  They are only briefly
  4451.     reviewed here.  Be sure to look at the utility file "dump.c" for
  4452.     examples of function usage.
  4453.     
  4454.     
  4455.     SEE ALSO:  dvid_printfa(), dvid_putsa()
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489. DV_PUTC.FNC - Thu 23 Nov 89 00:20 - Page 69:  
  4490.  
  4491.     NAME
  4492.     
  4493.            dvid_putchr -- write a character to the screen
  4494.     
  4495.     
  4496.     PROTOTYPED IN:  mflconio.h
  4497.     
  4498.     
  4499.     SYNOPSIS
  4500.     
  4501.            dvid_putchr(ch);         
  4502.            char ch;                8 bit character value
  4503.     
  4504.     
  4505.     DESCRIPTION
  4506.     
  4507.     The dvid_putchr() function is the real workhorse of the direct video
  4508.     functions.  It is this function which writes the specified (char) to the
  4509.     screen memory with the current attribute at the current internal row/col
  4510.     position.  The direct video access functions are described in some
  4511.     detail in the users manual accompanying the MicroFirm Function Library.
  4512.     They are only briefly reviewed here.  Be sure to look at the utility
  4513.     file "dump.c" for examples of function usage.
  4514.     
  4515.     
  4516.     SEE ALSO:  dvid_putstr(), dvid_putsa()
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555. DV_PUTS.FNC - Thu 23 Nov 89 00:20 - Page 70:  
  4556.  
  4557.     NAME
  4558.     
  4559.            dvid_putstr -- write a string to screen
  4560.     
  4561.     
  4562.     PROTOTYPED IN:  mflconio.h
  4563.     
  4564.     
  4565.     SYNOPSIS
  4566.     
  4567.            dvid_putstr(str);        
  4568.            char *str;              character string
  4569.            char ch;                8 bit character value
  4570.     
  4571.     
  4572.     DESCRIPTION
  4573.     
  4574.     The dvid_putstr() function places a string at the current internal
  4575.     cursor position.  This may not be the visible cursor position, since the
  4576.     visible cursor is updated to the internal cursor only with the
  4577.     dvid_flush() function.  The direct video access functions are described
  4578.     in some detail in the users manual accompanying the MicroFirm Function
  4579.     Library.  They are only briefly reviewed here.  Be sure to look at the
  4580.     utility file "dump.c" for examples of function usage.
  4581.     
  4582.     
  4583.     SEE ALSO:  dvid_putchr(), dvid_putsa()
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621. DV_PUTSA.FNC - Thu 23 Nov 89 00:20 - Page 71:  
  4622.  
  4623.     NAME
  4624.     
  4625.             dvid_putsa -- display a string with attribute
  4626.     
  4627.     
  4628.     PROTOTYPED IN:  mflconio.h
  4629.     
  4630.     
  4631.     SYNOPSIS
  4632.     
  4633.             dvid_putsa(string,vattr);
  4634.             char *string;   string to display
  4635.             int vattr;      video attribute to use
  4636.     
  4637.     
  4638.     DESCRIPTION
  4639.     
  4640.     The dvid_putsa function works exactly the same as fputs and requires the
  4641.     use of the display package (i.e. dvid_init must have previously been
  4642.     called). The specified string is displayed in the specified attribute.
  4643.     Any newline characters, embedded or trailing, will invoke a temporary
  4644.     switch back to the old attribute, thus attribute bleeding when
  4645.     scrolling.
  4646.     
  4647.     
  4648.     EXAMPLE
  4649.     
  4650.             dvid_putsa("This is\na test",YELLOW+(BLUE<<4),NORMAL);
  4651.     
  4652.     
  4653.     SEE ALSO:  dvid_init()
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687. DV_RAW.FNC - Thu 23 Nov 89 00:20 - Page 72:  
  4688.  
  4689.     NAME
  4690.     
  4691.            dvid_raw -- set display mode for control characters
  4692.     
  4693.     
  4694.     PROTOTYPED IN:  mflconio.h
  4695.     
  4696.     
  4697.     SYNOPSIS
  4698.     
  4699.            dvid_raw(rawflag);       
  4700.            int rawflag;            LOGICAL flag (TRUE or FALSE)
  4701.     
  4702.     
  4703.     DESCRIPTION
  4704.     
  4705.     The dvid_raw() function determines how characters between 00h and 1fh
  4706.     will be treated.  The display package defaults to a mode which treats
  4707.     characters such as carriage return and bell as true control
  4708.     characters, rather than values to be displayed.  By calling this
  4709.     function with an argument of TRUE, any of these characters will be
  4710.     literally displayed, rather than interpreted as controls.  Calling
  4711.     divd_raw(FALSE) restores normal operation.  Does not have any effect
  4712.     if BIOS mode has been enabled.  The direct video access functions are
  4713.     described in some detail in the users manual accompanying the
  4714.     MicroFirm Function Library.  They are only briefly reviewed here.  Be
  4715.     sure to look at the utility file "dump.c" for examples of function
  4716.     usage.
  4717.     
  4718.     
  4719.     SEE ALSO:  dvid_getmode()
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753. DV_REP.FNC - Thu 23 Nov 89 00:20 - Page 73:  
  4754.  
  4755.     NAME
  4756.     
  4757.            dvid_rep -- write a repeated character
  4758.     
  4759.     
  4760.     PROTOTYPED IN:  mflconio.h
  4761.     
  4762.     
  4763.     SYNOPSIS
  4764.     
  4765.            dvid_rep(ch, count);  
  4766.            char ch;                8 bit character value
  4767.            int count;              number of chars to write or repeat
  4768.     
  4769.     
  4770.     DESCRIPTION
  4771.     
  4772.     The dvid_rep() function will place a given number of a repeated
  4773.     character at the current internal cursor position.  An alternate method
  4774.     is to use dvid_setcount() followed by dvid_putchr().  The direct video
  4775.     access functions are described in some detail in the users manual
  4776.     accompanying the MicroFirm Function Library.  They are only briefly
  4777.     reviewed here.  Be sure to look at the utility file "dump.c" for
  4778.     examples of function usage.
  4779.     
  4780.     
  4781.     SEE ALSO:  dvid_setcount(), dvid_putchr()
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819. DV_SAY.FNC - Thu 23 Nov 89 00:20 - Page 74:  
  4820.  
  4821.     NAME
  4822.     
  4823.             dvid_say -- display a string at specified position
  4824.     
  4825.     
  4826.     PROTOTYPED IN:  mflconio.h
  4827.     
  4828.     
  4829.     SYNOPSIS
  4830.     
  4831.             void dvid_say(row, col, string);
  4832.             int row, col;     position to display
  4833.             char *string;     string to display
  4834.             char ch;          character to display
  4835.     
  4836.     
  4837.     DESCRIPTION
  4838.     
  4839.     This function uses the features of the MicroFirm Function Library's
  4840.     display package functions, and must therefore follow the rules laid down
  4841.     for their use.  Specifically, dvid_init() must be called prior to using
  4842.     this function, and the function may fail if the target system is not a
  4843.     very close compatible since direct memory writing is being used.
  4844.     dvid_say() writes a string at the current real cursor position and then
  4845.     executes a dvid_flush() call before returning, thereby insuring cursor
  4846.     updating.
  4847.     
  4848.     
  4849.     EXAMPLE
  4850.     
  4851.             int i;
  4852.             dvid_init();    /* initialize the package */
  4853.             dvid_cls();     /* clear the screen */
  4854.             dvid_say(0, 0, "Hello");  /* write to upper left corner */
  4855.             for(i = 0; i < 10; i++) {
  4856.                 dvid_char_at(i, i+1, i | '0');  /* write a sequence */
  4857.             }
  4858.             dvid_move(12, 40);   /* move to center of screen */
  4859.             dvid_flush();        /* physically update screen cursor */
  4860.             dvid_sayr(20, 70, "Goodby");  /* write into lower corner */
  4861.             dvid_putc('!');   /* this char should be at 12, 40 */
  4862.     
  4863.     
  4864.     SEE ALSO: d_say(), dvid_sayr(), dvid_char_at(), dvid_char_atr()
  4865.     
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885. DV_SAYR.FNC - Thu 23 Nov 89 00:20 - Page 75:  
  4886.  
  4887.     NAME
  4888.     
  4889.             dvid_sayr -- dvid_say, returns cursor to starting point
  4890.     
  4891.     
  4892.     PROTOTYPED IN:  mflconio.h
  4893.     
  4894.     
  4895.     SYNOPSIS
  4896.     
  4897.             void dvid_sayr(row, col, string);
  4898.             int row, col;     position to display
  4899.             char *string;     string to display
  4900.             char ch;          character to display
  4901.     
  4902.     
  4903.     DESCRIPTION
  4904.     
  4905.     This function uses the features of the MicroFirm Function Library's
  4906.     display package functions, and must therefore follow the rules laid down
  4907.     for their use.  Specifically, dvid_init() must be called prior to using
  4908.     this function, and the function may fail if the target system is not a
  4909.     very close compatible since direct memory writing is being used.
  4910.     dvid_sayr() writes a string at the current real cursor position.  Before
  4911.     using this call, be sure the display package cursor position and the
  4912.     screen position are equal by doing a dvid_flush() call.
  4913.     
  4914.     
  4915.     EXAMPLE
  4916.     
  4917.             int i;
  4918.             dvid_init();    /* initialize the package */
  4919.             dvid_cls();     /* clear the screen */
  4920.             dvid_say(0, 0, "Hello");  /* write to upper left corner */
  4921.             for(i = 0; i < 10; i++) {
  4922.                 dvid_char_at(i, i+1, i | '0');  /* write a sequence */
  4923.             }
  4924.             dvid_move(12, 40);   /* move to center of screen */
  4925.             dvid_flush();        /* physically update screen cursor */
  4926.             dvid_sayr(20, 70, "Goodby");  /* write into lower corner */
  4927.             dvid_putc('!');   /* this char should be at 12, 40 */
  4928.     
  4929.     
  4930.     SEE ALSO: dvid_say(), d_say(), dvid_char_at(), dvid_char_atr()
  4931.     
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951. DV_SCRL.FNC - Thu 23 Nov 89 00:20 - Page 76:  
  4952.  
  4953.     NAME
  4954.     
  4955.            dvid_scroll -- scroll a region of the screen
  4956.     
  4957.     
  4958.     PROTOTYPED IN:  mflconio.h
  4959.     
  4960.     
  4961.     SYNOPSIS
  4962.     
  4963.            dvid_scroll(lines, srow, scol, erow, ecol, attrib);
  4964.            int lines;              mode for region scroll
  4965.            int srow;               starting row number
  4966.            int erow;               ending row number
  4967.            int scol;               starting column number
  4968.            int ecol;               ending column number
  4969.            int attribute;          video attribute
  4970.     
  4971.     
  4972.     DESCRIPTION
  4973.     
  4974.     The dvid_scroll() function scrolls a region of the screen.  If the first
  4975.     argument is equal to 0 the region is cleared.  If less than zero, the
  4976.     region is scrolled down.  If greater than zero, scrolled up.  The direct
  4977.     video access functions are described in some detail in the users manual
  4978.     accompanying the MicroFirm Function Library.  They are only briefly
  4979.     reviewed here.  Be sure to look at the utility file "dump.c" for
  4980.     examples of function usage.
  4981.     
  4982.     
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017. DV_SETCT.FNC - Thu 23 Nov 89 00:20 - Page 77:  
  5018.  
  5019.     NAME
  5020.     
  5021.            dvid_setcount -- set number of chars to write
  5022.     
  5023.     
  5024.     PROTOTYPED IN:  mflconio.h
  5025.     
  5026.     
  5027.     SYNOPSIS
  5028.     
  5029.            dvid_setcount(count);    
  5030.            int count;              number of chars to write or repeat
  5031.     
  5032.     
  5033.     DESCRIPTION
  5034.     
  5035.     The dvid_setcount() function sets the number of times the NEXT character
  5036.     displayed will be actually displayed.  Always is automatically restored
  5037.     to 1.  The direct video access functions are described in some detail in
  5038.     the users manual accompanying the MicroFirm Function Library.  They are
  5039.     only briefly reviewed here.  Be sure to look at the utility file
  5040.     "dump.c" for examples of function usage.
  5041.     
  5042.     
  5043.     SEE ALSO:  dvid_putchr()
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083. DV_SETPG.FNC - Thu 23 Nov 89 00:20 - Page 78:  
  5084.  
  5085.     NAME
  5086.     
  5087.            dvid_setpage -- set video page for writing, reading, and display
  5088.     
  5089.     
  5090.     PROTOTYPED IN:  mflconio.h
  5091.     
  5092.     
  5093.     SYNOPSIS
  5094.     
  5095.            dvid_setpage(page, mode); 
  5096.            int page;               video page number 0-7
  5097.            int mode;               LOGICAL flag (TRUE or FALSE)
  5098.     
  5099.     
  5100.     DESCRIPTION
  5101.     
  5102.     The dvid_setpage() function is used ONLY with CGA cards, which may
  5103.     switch their video "pages".  In 40 column modes, there are 8 pages
  5104.     numbered 0-7.  In 80 column modes, there are 4 pages, numbered 0-3.
  5105.     Any page may be set for reading or writing, while setting a different
  5106.     or the same page for actual display.  The (page) argument specifies
  5107.     the page number desired for writing, and is checked against the
  5108.     current video mode for correctness.  The (mode) argument is 0 to
  5109.     select the page for writing/reading only, without changing the page
  5110.     current specified for display.  (mode) set to 1 also changes the
  5111.     displayed page to the indicated (page).  This function may therefore
  5112.     be used to alter not only the destination for direct memory writes,
  5113.     but also may be used to switch the display to the various pages.  The
  5114.     direct video access functions are described in some detail in the
  5115.     users manual accompanying the MicroFirm Function Library.  They are
  5116.     only briefly reviewed here.  Be sure to look at the utility file
  5117.     "dump.c" for examples of function usage.
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149. DV_SYNC.FNC - Thu 23 Nov 89 00:20 - Page 79:  
  5150.  
  5151.     NAME
  5152.     
  5153.            dvid_sync -- enable or disable video sync
  5154.     
  5155.     
  5156.     PROTOTYPED IN:  mflconio.h
  5157.     
  5158.     
  5159.     SYNOPSIS
  5160.     
  5161.            dvid_sync(mode);         
  5162.            int mode;               LOGICAL flag (TRUE or FALSE)
  5163.     
  5164.     
  5165.     DESCRIPTION
  5166.     
  5167.     The dvid_sync() function is used to control video synchronization on
  5168.     CGA cards.  Normally, the functions default to sync enabled to
  5169.     prevent video "snow" during writes.  (mode) may be set to FALSE to
  5170.     disable video sync.  On some color cards, no snow will result evem
  5171.     without sync.  For all cards, disabling sync will speed up access,
  5172.     although the resulting "snow" may be objectionable.  N.B.: Often,
  5173.     there will be a little snow on the left edge of the screen, even with
  5174.     video sync enabled.  Turning off the visible cursor using
  5175.     cursor_style() in this library can often eliminate the snow, which is
  5176.     actually caused by the cursor itself.  The direct video access
  5177.     functions are described in some detail in the users manual
  5178.     accompanying the MicroFirm Function Library.  They are only briefly
  5179.     reviewed here.  Be sure to look at the utility file "dump.c" for
  5180.     examples of function usage.
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215. ENTERDAT.FNC - Thu 23 Nov 89 00:20 - Page 80:  
  5216.  
  5217.     NAME
  5218.     
  5219.             enterdata -- enter a string of data from keyboard
  5220.     
  5221.     
  5222.     PROTOTYPED IN:  mflconio.h
  5223.     
  5224.     
  5225.     SYNOPSIS
  5226.     
  5227.             r = enterdata(dest, qty, row, col, mode);
  5228.             int r;          returns TRUE or FALSE
  5229.             char *dest;     destination for string
  5230.             int qty;        maximum allowable chars + 1
  5231.             int row, col;   row and column of string start*
  5232.             int mode;       mode for character checking
  5233.     
  5234.     
  5235.     DESCRIPTION
  5236.     
  5237.     enterdata() provides a convenient method for entering character
  5238.     strings from the keyboard and verifying the character syntax.  Line
  5239.     editing is supported to enhance user input.  Entry is as follows:
  5240.     
  5241.             Carriage Return terminates input and returns TRUE. If no other
  5242.                 data was entered, destination string is NULLed in the
  5243.                 first position. CR is not placed into destination.
  5244.             ESCape terminates entry at once, NULLs destination, clears
  5245.                 screen field, and returns FALSE.
  5246.             HOME clears field, and restarts entry without returning.
  5247.             BACKSPACE and Cursor Left will destructively backspace up
  5248.                 to beginning of field.
  5249.             Only qty - 1 characters will be accepted.
  5250.             Any error sounds console BELL.
  5251.             Various modes allow for checking of syntax and mapping of characters
  5252.     :
  5253.                 Mode 0:   allow any printable character (ASCII 20H - 7FH)
  5254.                 Mode 1:   allow only alphabetics (A-Z, a-z)
  5255.                 Mode 2:   allow alphabetics and numerals only
  5256.                 Mode 3:   allow numerials only Mode 4: allow hexadecimal
  5257.                 characters only (0-9, A-F, a-f) Modes 0, 1, and 2 will map
  5258.                 lower case to upper case if decimal 128 (80H) is OR'd with
  5259.                 the mode.
  5260.     
  5261.        * If row = -1, then current cursor position will be used, and col value i
  5262.     s ignored.
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281. ENTERDAT.FNC - Thu 23 Nov 89 00:20 - Page 81:  
  5282.  
  5283.  
  5284.     EXAMPLE
  5285.     
  5286.                char string[31];
  5287.                unsigned int num;
  5288.     
  5289.                d_pos(10, 20, 0);      /* cursor to row 10, column 20 */
  5290.                fputs("Enter an alphabetic string: ", stdout);
  5291.                if(!enterdata(string, 31, 10, 48, 1)) {
  5292.                   fputs("\nESCape was pressed");
  5293.                   }
  5294.                else printf("\nString entered is %s\n", string);
  5295.     
  5296.                fputs("Enter hex value at current cursor position: ", stdout);
  5297.                if(!enterdata(string, 5, -1, 0, 4)) {
  5298.                   fputs("\nESCape was pressed");
  5299.                   }
  5300.                else {
  5301.                   num = atoi(string);
  5302.                   printf("Number entered was %4x", num);
  5303.                   }
  5304.     
  5305.     
  5306.     SEE ALSO: disp_enterdata()
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347. ENTERFN.FNC - Thu 23 Nov 89 00:20 - Page 82:  
  5348.  
  5349.     NAME
  5350.     
  5351.             enterfn -- enter a filename from keyboard
  5352.     
  5353.     
  5354.     PROTOTYPED IN:  mflconio.h
  5355.     
  5356.     
  5357.     SYNOPSIS
  5358.     
  5359.             void enterfn(dest, qty, row, col, allow);
  5360.             char *dest;     destination for string
  5361.             int qty;        maximum allowable chars + 1
  5362.             int row, col;   row and column of string start*
  5363.             int allow;      TRUE to allow entension entry
  5364.     
  5365.     
  5366.     DESCRIPTION
  5367.     
  5368.     enterfn() provides a convenient method for entering a path and
  5369.     filename from the keyboard and verifying the character syntax.  Line
  5370.     editing is supported to enhance user input.  Entry is as follows:
  5371.     
  5372.             Carriage Return terminates input.
  5373.               If no other data was entered, destination string
  5374.               is NULLed in the first position. CR is not placed
  5375.               into destination.
  5376.             ESCape terminates entry at once, NULLs destination,
  5377.               and clears screen field.
  5378.             HOME clears field, and restarts entry without returning.
  5379.             BACKSPACE and Cursor Left will destructively backspace
  5380.               up to beginning of field.
  5381.             Only qty - 1 characters will be accepted.
  5382.             Any error sounds console BELL.
  5383.             If "allow" is TRUE, then a filename extension may be
  5384.               entered.  Otherwise, no extension may be entered, since
  5385.               the period character will be disallowed.
  5386.             A drive may be specified; the colon is only allowed in the
  5387.               second character string position.
  5388.     
  5389.     
  5390.     EXAMPLE
  5391.             char string[31];
  5392.             d_pos(10, 20, 0);      /* cursor to row 10, column 20 */
  5393.             fputs("Enter a filename: ", stdout);
  5394.             enterfn(string, 31, 10, 38, TRUE));
  5395.             fputs("Enter filename at current cursor position: ", stdout);
  5396.             enterfn(string, 31, -1, 0, FALSE);
  5397.     
  5398.           * If row = -1, then current cursor position will be used, and
  5399.             col value is ignored.
  5400.     
  5401.     
  5402.     SEE ALSO: disp_enterfn()
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413. ERAOK.FNC - Thu 23 Nov 89 00:20 - Page 83:  
  5414.  
  5415.     NAME
  5416.     
  5417.             eraok -- ask permission before overwriting existing file
  5418.     
  5419.     
  5420.     PROTOTYPED IN:  mflfiles.h
  5421.     
  5422.     
  5423.     SYNOPSIS
  5424.     
  5425.             void eraok(filename);
  5426.             char *filename  filename to test
  5427.     
  5428.     
  5429.     DESCRIPTION
  5430.     
  5431.     This function checks for the existance of the specified filename
  5432.     and if it exists, will ask the user (through stderr) if the file
  5433.     can be lost.  If the user responds Y or y, the file is lost and
  5434.     return is made to the caller.  If the response is anything else,
  5435.     the program aborts immediately, and the routine does NOT return
  5436.     to the caller.  Exit is via the aabort() function of this library.
  5437.     
  5438.     
  5439.     EXAMPLE
  5440.          (assume argv[1] is string "foobar.com")
  5441.     
  5442.          eraok(argv[1]);
  5443.          printf("File %s has been deleted", argv[1]);
  5444.  
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479. ERROR.FNC - Thu 23 Nov 89 00:20 - Page 84:  
  5480.  
  5481.     NAME
  5482.     
  5483.             error -- report a fatal error and exit
  5484.     
  5485.     
  5486.     PROTOTYPED IN:  mflsys.h
  5487.     
  5488.     
  5489.     SYNOPSIS
  5490.     
  5491.             void error(string);
  5492.             char *string;   error message to report
  5493.     
  5494.     
  5495.     DESCRIPTION
  5496.     
  5497.     This function sends the specified error message to stderr, and
  5498.     then exits through this library's aabort() function, sounding
  5499.     the console bell on its way out.
  5500.     
  5501.     
  5502.     EXAMPLE
  5503.          error("Invalid syntax");
  5504.     
  5505.     
  5506.     SEE ALSO: aabort()
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545. EXISTS.FNC - Thu 23 Nov 89 00:20 - Page 85:  
  5546.  
  5547.     NAME
  5548.     
  5549.             exists -- see if a file exists
  5550.     
  5551.     
  5552.     PROTOTYPED IN:  mflfiles.h
  5553.     
  5554.     
  5555.     SYNOPSIS
  5556.     
  5557.             r = exists(name);
  5558.             int r;          returns FALSE if not found, else TRUE
  5559.             char *name;     filename to check
  5560.     
  5561.     
  5562.     DESCRIPTION
  5563.     
  5564.     If the specified filename, which may include drive and
  5565.     directory, is not found, then a value of zero (FALSE)
  5566.     is returned.  Else, one (TRUE) is returned.  This
  5567.     test does not take into consideration any attributes on
  5568.     the file, so that an fopen() call may still fail later.
  5569.     
  5570.     
  5571.     EXAMPLE
  5572.     
  5573.            if(exists("a:foo.bar")) puts("File exists!");
  5574.            else puts("File does not exist");
  5575.     
  5576.     
  5577.     SEE ALSO: access()
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611. EXIT2DOS.FNC - Thu 23 Nov 89 00:20 - Page 86:  
  5612.  
  5613.     NAME
  5614.     
  5615.             exit2dos -- permission to exit program
  5616.     
  5617.     
  5618.     PROTOTYPED IN:  mflfiles.h
  5619.     
  5620.     
  5621.     SYNOPSIS
  5622.     
  5623.             void exit2dos();
  5624.     
  5625.     
  5626.     DESCRIPTION
  5627.     
  5628.     When invoked, this function clears the screen and places
  5629.     the message "Exit to DOS?" in the center of the display.
  5630.     The keyboard is read, and if the response is 'Y' or 'y',
  5631.     an aabort(0) function is called.  For any other response,
  5632.     the function simply returns to the users program, which
  5633.     must then do whatever is necessary to continue with the
  5634.     program.
  5635.     
  5636.     
  5637.     EXAMPLE
  5638.             if(getche() == ESC) exit2dos();  /* watch for ESCape key */
  5639.             else domorework();
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677. EXPARG.FNC - Thu 23 Nov 89 00:20 - Page 87:  
  5678.  
  5679.     NAME
  5680.     
  5681.             expand_arg -- expand command line wildcard filenames
  5682.     
  5683.     
  5684.     PROTOTYPED IN:  mflfiles.h
  5685.     
  5686.     
  5687.     SYNOPSIS
  5688.     
  5689.             nargc = expand_arg(argc, argv);
  5690.             int nargc;              no. of arguments in nargv
  5691.             int argc;               no. of original arguments
  5692.             char *argv[];           original argument array
  5693.             extern char **nargv;    expanded argument array
  5694.     
  5695.     
  5696.     
  5697.     DESCRIPTION
  5698.     
  5699.     The expand_arg() function is similar to UNIX exarg processing to expand
  5700.     wildcard filenames.  This makes wildcard expansion totally transparent
  5701.     to the programmer.  Most implementations of C compilers for MS-DOS don't
  5702.     provide this expansion.  Therefore, if one command line argument is
  5703.     "*.ASM", this becomes one of the arguments to a program, instead of all
  5704.     files which will match the expansion.  expand_arg() will take the (argc,
  5705.     argv) passed through the main() function, and make a new array, called
  5706.     (nargc, nargv) which will contain the expanded parameters.  If there are
  5707.     no wildcards to expand, the new array winds up being the same as the old
  5708.     array.  In addition, certain arguments will not be expanded, as they
  5709.     will be considered possible "options" or "literals".  Any argument
  5710.     beginning with a hyphen (-), fraction bar (/), or single/double quote ("
  5711.     ') will not be expanded.  Arguments beginning with a reverse slash (\)
  5712.     will be assumed to contain a directory name as part of a potential
  5713.     filename.  Arguments will be expanded if they contain either of the
  5714.     wildcard characters (*) or (?).  No matches to the specification will
  5715.     return no filenames.  A filename without a wildcard designator will be
  5716.     passed to the new array without testing for existence.  Filenames
  5717.     expanded will, of course, exist, or they wouldn't have been found.
  5718.     
  5719.     The label "nargc" is not a mandatory label.  It is chosen merely for
  5720.     convenience in designating the new argument count.  However, the array
  5721.     name "nargv" is a requirement, since the object module expand_arg
  5722.     defines that item.  If you use the file "smdefs.h", the external
  5723.     reference to nargv will be done automatically, and you needn't worry
  5724.     about it.
  5725.     
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.  
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743. EXPARG.FNC - Thu 23 Nov 89 00:20 - Page 88:  
  5744.  
  5745.  
  5746.     The expand_arg() function does dynamic memory allocation and re-
  5747.     allocation, and therefore should be called as the FIRST function after
  5748.     main(), and NEVER called again within the program.  Violation of this
  5749.     requirement may cause some arguments to be lost if this function has to
  5750.     reallocate memory during expansion.  Since wildcard expansion may result
  5751.     in more or less arguments than originally passed, nargc will seldom
  5752.     equal argc.  It may be either larger or smaller.
  5753.     
  5754.     After calling expand_arg(), the variables nargc and nargv may be used
  5755.     anywhere you would normally have used argc and argv.  If expand_arg()
  5756.     fails (usually a memory allocatiion problem), it will return a value of
  5757.     0.  No command line options would return 1, since the program name
  5758.     itself is a command line argument.
  5759.     
  5760.     EXAMPLE
  5761.     
  5762.                #include <stdio.h>
  5763.                #include <mflfiles.h>
  5764.                int nargc;
  5765.     
  5766.                main(int argc, char *argv[])
  5767.                {
  5768.                     int i;
  5769.                     nargc = expand_arg(argc, argv);
  5770.                     if(nargc == 0)
  5771.                             error("Memory allocation error");
  5772.                     for(i = 0; i < nargc; i++)
  5773.                             printf("Argument %d is %s\n", i, nargv[i]);
  5774.                }
  5775.     
  5776.     
  5777.     SEE ALSO:  Demo WC.C
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809. EXTTYP.FNC - Thu 23 Nov 89 00:20 - Page 89:  
  5810.  
  5811.     NAME
  5812.     
  5813.             exttyp -- check a filename for a particular extension
  5814.     
  5815.     
  5816.     PROTOTYPED IN:  mflfiles.h
  5817.     
  5818.     
  5819.     SYNOPSIS
  5820.     
  5821.             r = exttyp(filename, extn);
  5822.             int r;         returns TRUE if match, else FALSE
  5823.             char *filename  filename to test
  5824.             char *extn      extension string for match
  5825.     
  5826.     
  5827.     DESCRIPTION
  5828.     
  5829.     This function makes no changes to either entry parameter,
  5830.     but simply returns TRUE if the specified extension is found in
  5831.     the filename, or FALSE (0) if it is not.  Case of the characters is
  5832.     ignored.  The function is most useful to insure that a particular
  5833.     program will only use an extension of a specified type.
  5834.     
  5835.     
  5836.     EXAMPLE
  5837.          (assume argv[1] is string "foobar.com")
  5838.     
  5839.          if(exttyp(argv[1], "COM")) printf("File is executable");
  5840.          else printf("File is not executable");
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875. FCBCLOSE.FNC - Thu 23 Nov 89 00:20 - Page 90:  
  5876.  
  5877.     NAME
  5878.     
  5879.             FCB_close  -- close a file using a file control block
  5880.     
  5881.     
  5882.     PROTOTYPED IN:  mflfiles.h
  5883.     
  5884.     
  5885.     SYNOPSIS
  5886.     
  5887.             r = FCB_close(f);
  5888.             int r;          SUCCESS or ERROR
  5889.             struct xfcb *f; pointer to opened FCB to close
  5890.     
  5891.     
  5892.     DESCRIPTION
  5893.     
  5894.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  5895.     file handling was superceded by the use of file handles. Even
  5896.     though rarely used, DOS retains the ability to process the older
  5897.     style FCB calls. This is normally of little interest except that
  5898.     there are still two functions which cannot be performed any way
  5899.     except by the use of FCBs.
  5900.     
  5901.     DOS has no provisions for creating or deleting a volume label
  5902.     using file handles. FCB_creat() will allow any type of file, even
  5903.     volume labels, to be created. Note that the file name may not
  5904.     contain any path information since DOS 1.0 (and CP/M before it)
  5905.     did not support nested subdirectories. You must therefore be in
  5906.     the same directory where the file is to be created. See pushdir()
  5907.     and popdir() for a convenient way to relocate to a directory where
  5908.     an FCB operation is to be performed.
  5909.     
  5910.     FCB_close() closes a previously opened FCB and deallocates its
  5911.     memory.
  5912.     
  5913.     
  5914.     EXAMPLE
  5915.     
  5916.             char buf[128];
  5917.             struct XFCB my_fcb;
  5918.             if (NULL != (my_fcb=FCB_open("fname.tmp", -1))) {
  5919.                FCB_reads(my_fcb,buf);       /* read the 1st record  */
  5920.                FCB_readr(my_fcb,buf,7L);    /* read the 7th record  */
  5921.     
  5922.                FCB_writes(my_fcb,buf);      /* write the 8th record */
  5923.                FCB_writer(my_fcb,buf,4L);   /* write the 4th record */
  5924.             }
  5925.             FCB_close(my_fcb);
  5926.     
  5927.     
  5928.     SEE ALSO: FCB_creat(), FCB_kill(), FCB_open()
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941. FCBCREAT.FNC - Thu 23 Nov 89 00:20 - Page 91:  
  5942.  
  5943.     NAME
  5944.     
  5945.             FCB_creat  -- create a file using a file control block
  5946.     
  5947.     
  5948.     PROTOTYPED IN:  mflfiles.h
  5949.     
  5950.     
  5951.     SYNOPSIS
  5952.     
  5953.             r = FCB_creat(fname,attrib);
  5954.             int r;          returns 0 if success, else ERROR
  5955.             char *fname;    name of the file to create
  5956.             int attrib;     attribute of the file to create
  5957.     
  5958.     
  5959.     DESCRIPTION
  5960.     
  5961.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  5962.     file handling was superceded by the use of file handles. Even though
  5963.     rarely used, DOS retains the ability to process the older style FCB
  5964.     calls. This is normally of little interest except that there are still
  5965.     two functions which cannot be performed any way except by the use of
  5966.     FCBs.
  5967.     
  5968.     DOS has no provisions for creating or deleting a volume label using
  5969.     file handles. FCB_creat() will allow any type of file, even volume
  5970.     labels, to be created. Note that the file name may not contain any
  5971.     path information since DOS 1.0 (and CP/M before it) did not support
  5972.     nested subdirectories. You must therefore be in the same directory
  5973.     where the file is to be created. See pushdir() and popdir() for a
  5974.     convenient way to relocate to a directory where an FCB operation is to
  5975.     be performed.
  5976.     
  5977.     
  5978.     EXAMPLE
  5979.             struct FIND *ffblk;
  5980.             char *p;
  5981.             pushdir("C:\\");        /* go to the C: root directory  */
  5982.             /* next look for an old volume label to delete, but be  */
  5983.             /* aware that its filename may have to be fixed         */
  5984.              if (NULL != (ffblk = findfirst("*.*", FA_LABEL))) do {
  5985.                if (fflbk->attribute & FA_LABEL)
  5986.                   break;
  5987.             } while (NULL != (ffblk = findnext()));
  5988.              if (ffblk) {
  5989.                if ('.' == ffblk->name[8]) /* not in a volume label  */
  5990.                   strcpy(&ffblk->name[8], &ffblk->name[9]);
  5991.                FCB_kill(ffblk->name, FA_LABEL);
  5992.             }
  5993.              /* create a new volume label                           */
  5994.              FCB_creat("A NEW LABEL", FA_LABEL);
  5995.              if (!chdir("PIRATED")) /* go to a subdirectory         */
  5996.                FCB_kill("*.*", 0);  /* quickly wipe out all files   */
  5997.             popdir();               /* go back where we were        */
  5998.     
  5999.     
  6000.     SEE ALSO: FCB_kill(), FCB_open(), FCB_close()
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007. FCBKILL.FNC - Thu 23 Nov 89 00:20 - Page 92:  
  6008.  
  6009.     NAME
  6010.     
  6011.             FCB_kill   -- delete a file using a file control block
  6012.     
  6013.     
  6014.     PROTOTYPED IN:  mflfiles.h
  6015.     
  6016.     
  6017.     SYNOPSIS
  6018.     
  6019.             r = FCB_kill(fname,attrib);
  6020.             int r;          returns 0 if success, else ERROR
  6021.             char *fname;    name of the file to delete
  6022.             int attrib;     attribute of the file to delete
  6023.     
  6024.     
  6025.     DESCRIPTION
  6026.     
  6027.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  6028.     file handling was superceded by the use of file handles. Even though
  6029.     rarely used, DOS retains the ability to process the older style FCB
  6030.     calls. This is normally of little interest except that there are still
  6031.     two functions which cannot be performed any way except by the use of
  6032.     FCBs.
  6033.     
  6034.     FCB_kill() is capable of deleting volume labels, which no other DOS
  6035.     function can do. Perhaps even more useful is it's capability to delete
  6036.     multiple wildcard-specified files. This is how DOS's own DEL and ERASE
  6037.     commands can delete entire groups of files so much more quickly than
  6038.     by using findfirst()/findnext() and unlink().
  6039.     
  6040.     One note on the kill and create functions - You will notice than
  6041.     FCB_kill also requires an attribute parameter be passed to it. The
  6042.     reason for this is because volume labels break all the DOS rules
  6043.     for file naming. Both FCB_creat() and FCB_kill process file names
  6044.     quite differently when the file is known to be a volume label -
  6045.     which may contain spaces, and other characters illegal in DOS
  6046.     filenames.
  6047.     
  6048.     
  6049.     EXAMPLE
  6050.             struct FIND *ffblk;
  6051.             char *p;
  6052.             pushdir("C:\\");        /* go to the C: root directory  */
  6053.              /* next look for an old volume label to delete, but be  */
  6054.             /* aware that its filename may have to be fixed         */
  6055.              if (NULL != (ffblk = findfirst("*.*", FA_LABEL))) do {
  6056.                if (fflbk->attribute & FA_LABEL)
  6057.                   break;
  6058.             } while (NULL != (ffblk = findnext()));
  6059.              if (ffblk) {
  6060.                if ('.' == ffblk->name[8]) /* not in a volume label  */
  6061.                   strcpy(&ffblk->name[8], &ffblk->name[9]);
  6062.                FCB_kill(ffblk->name, FA_LABEL);
  6063.             }
  6064.     
  6065.     
  6066.     SEE ALSO: FCB_creat(), FCB_open(), FCB_close()
  6067.     
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073. FCBREADR.FNC - Thu 23 Nov 89 00:20 - Page 93:  
  6074.  
  6075.     NAME
  6076.     
  6077.             FCB_readr  -- random read using a file control block
  6078.     
  6079.     
  6080.     PROTOTYPED IN:  mflfiles.h
  6081.     
  6082.     
  6083.     SYNOPSIS
  6084.     
  6085.              r = FCB_readr(f,buf,rec);
  6086.              int r;          SUCCESS or ERROR
  6087.              struct xfcb *f; pointer to opened FCB
  6088.              char *buf;      buffer to receive the data
  6089.              long rec;       record number to read
  6090.     
  6091.     
  6092.     DESCRIPTION
  6093.     
  6094.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  6095.     file handling was superceded by the use of file handles. Even though
  6096.     rarely used, DOS retains the ability to process the older style FCB
  6097.     calls. This is normally of little interest except that there are still
  6098.     two functions which cannot be performed any way except by the use of
  6099.     FCBs.
  6100.     
  6101.     FCB_readr() reads data from a previously opened file using FCBs. data
  6102.     are read as records of watever size was specified (if any - default is
  6103.     128-byte records) in the the call to FCB_open().  FCB_readr() reads
  6104.     random records as specified in the calling parameters.
  6105.     
  6106.     
  6107.     EXAMPLE
  6108.     
  6109.             char buf[128];
  6110.             struct XFCB my_fcb;
  6111.             if (NULL != (my_fcb=FCB_open("fname.tmp", -1)))
  6112.             {
  6113.                 FCB_reads(my_fcb,buf);       /* read the 1st record  */
  6114.                 FCB_readr(my_fcb,buf,7L);    /* read the 7th record  */
  6115.                 FCB_writes(my_fcb,buf);      /* write the 8th record */
  6116.                 FCB_writer(my_fcb,buf,4L);   /* write the 4th record */
  6117.             }
  6118.             FCB_close(my_fcb);
  6119.     
  6120.     
  6121.     SEE ALSO: FCB_creat(), FCB_kill(), FCB_open(), FCB_close(), FCB_reads(),
  6122.               FCB_writes(), FCB_writer()
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139. FCBREADS.FNC - Thu 23 Nov 89 00:20 - Page 94:  
  6140.  
  6141.     NAME
  6142.     
  6143.             FCB_reads  -- sequential read using a file control block
  6144.     
  6145.     
  6146.     PROTOTYPED IN:  mflfiles.h
  6147.     
  6148.     
  6149.     SYNOPSIS
  6150.     
  6151.             r = FCB_reads(f,buf);
  6152.             int r;          SUCCESS or ERROR
  6153.             struct xfcb *f; pointer to opened FCB
  6154.             char *buf;      buffer to receive the data
  6155.     
  6156.     
  6157.     DESCRIPTION
  6158.     
  6159.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  6160.     file handling was superceded by the use of file handles. Even though
  6161.     rarely used, DOS retains the ability to process the older style FCB
  6162.     calls. This is normally of little interest except that there are still
  6163.     two functions which cannot be performed any way except by the use of
  6164.     FCBs.
  6165.     
  6166.     FCB_reads() reads data from a previously opened file using FCBs.  Data
  6167.     are read as records of watever size was specified (if any - default is
  6168.     128-byte records) in the the call to FCB_open(). FCB_reads() reads
  6169.     records sequentially.
  6170.     
  6171.     
  6172.     EXAMPLE
  6173.     
  6174.             char buf[128];
  6175.             struct XFCB my_fcb;
  6176.             if (NULL != (my_fcb=FCB_open("fname.tmp", -1)))
  6177.             {
  6178.                FCB_reads(my_fcb,buf);       /* read the 1st record  */
  6179.                FCB_readr(my_fcb,buf,7L);    /* read the 7th record  */
  6180.                FCB_writes(my_fcb,buf);      /* write the 8th record */
  6181.                FCB_writer(my_fcb,buf,4L);   /* write the 4th record */
  6182.             }
  6183.             FCB_close(my_fcb);
  6184.     
  6185.     
  6186.     SEE ALSO: FCB_creat(), FCB_kill(), FCB_open(), FCB_close(), FCB_readr(),
  6187.               FCB_writes(), FCB_writer()
  6188.     
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.  
  6201.  
  6202.  
  6203.  
  6204.  
  6205. FCBWRITR.FNC - Thu 23 Nov 89 00:20 - Page 95:  
  6206.  
  6207.     NAME
  6208.     
  6209.             FCB_writer -- random write using a file control block
  6210.     
  6211.     
  6212.     PROTOTYPED IN:  mflfiles.h
  6213.     
  6214.     
  6215.     SYNOPSIS
  6216.     
  6217.             r = FCB_writer(f,buf,rec);
  6218.             int r;          SUCCESS or ERROR
  6219.             struct xfcb *f; pointer to opened FCB
  6220.             char *buf;      buffer containing the data to write
  6221.             long rec;       record number to write
  6222.     
  6223.     
  6224.     DESCRIPTION
  6225.     
  6226.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  6227.     file handling was superceded by the use of file handles. Even
  6228.     though rarely used, DOS retains the ability to process the older
  6229.     style FCB calls. This is normally of little interest except that
  6230.     there are still two functions which cannot be performed any way
  6231.     except by the use of FCBs.
  6232.     
  6233.     FCB_writer() writes data to a previously opened file using FCBs.  Data
  6234.     are written as records of watever size was specified (if any - default
  6235.     is 128-byte records) in the the call to FCB_open().  FCB_writer()
  6236.     writes random records as specified in the calling parameters.
  6237.     
  6238.     
  6239.     EXAMPLE
  6240.     
  6241.             char buf[128];
  6242.             struct XFCB my_fcb;
  6243.             if (NULL != (my_fcb=FCB_open("fname.tmp", -1)))
  6244.             {
  6245.                FCB_reads(my_fcb,buf);       /* read the 1st record  */
  6246.                FCB_readr(my_fcb,buf,7L);    /* read the 7th record  */
  6247.                FCB_writes(my_fcb,buf);      /* write the 8th record */
  6248.                FCB_writer(my_fcb,buf,4L);   /* write the 4th record */
  6249.             }
  6250.             FCB_close(my_fcb);
  6251.     
  6252.     
  6253.     SEE ALSO: FCB_creat(), FCB_kill(), FCB_open(), FCB_close() FCB_reads(),
  6254.               FCB_readr(), FCB_writes()
  6255.     
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271. FCBWRITS.FNC - Thu 23 Nov 89 00:20 - Page 96:  
  6272.  
  6273.     NAME
  6274.     
  6275.             FCB_writes -- sequential write using a file control block
  6276.     
  6277.     
  6278.     PROTOTYPED IN:  mflfiles.h
  6279.     
  6280.     
  6281.     SYNOPSIS
  6282.     
  6283.             r = FCB_writes(f,buf);
  6284.             int r;          SUCCESS or ERROR
  6285.             struct xfcb *f; pointer to opened FCB
  6286.             char *buf;      buffer containing the data to write
  6287.     
  6288.     DESCRIPTION
  6289.     
  6290.     With the advent of DOS 2.0, the File Control Block (FCB) method of
  6291.     file handling was superceded by the use of file handles. Even
  6292.     though rarely used, DOS retains the ability to process the older
  6293.     style FCB calls. This is normally of little interest except that
  6294.     there are still two functions which cannot be performed any way
  6295.     except by the use of FCBs.
  6296.     
  6297.     FCB_writes() writes data to a previously opened file using FCBs.  Data
  6298.     are written as records of watever size was specified (if any - default
  6299.     is 128-byte records) in the the call to FCB_open(). FCB_writes()
  6300.     writes records sequentially.
  6301.     
  6302.     
  6303.     EXAMPLE
  6304.     
  6305.             char buf[128];
  6306.             struct XFCB my_fcb;
  6307.             if (NULL != (my_fcb=FCB_open("fname.tmp", -1)))
  6308.             {
  6309.                FCB_reads(my_fcb,buf);       /* read the 1st record  */
  6310.                FCB_readr(my_fcb,buf,7L);    /* read the 7th record  */
  6311.                FCB_writes(my_fcb,buf);      /* write the 8th record */
  6312.                FCB_writer(my_fcb,buf,4L);   /* write the 4th record */
  6313.             }
  6314.             FCB_close(my_fcb);
  6315.     
  6316.     
  6317.     SEE ALSO: FCB_creat(), FCB_kill(), FCB_open(), FCB_close(), FCB_reads(),
  6318.               FCB_readr(), FCB_writer()
  6319.     
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337. FCOPY.FNC - Thu 23 Nov 89 00:20 - Page 97:  
  6338.  
  6339.     NAME
  6340.     
  6341.             fcopy -- copy a file
  6342.     
  6343.     
  6344.     PROTOTYPED IN:  mflfiles.h
  6345.     
  6346.     
  6347.     SYNOPSIS
  6348.     
  6349.             r = fcopy(from,to,over);
  6350.             int r;          SUCCESS if file successfully copied, else ERROR
  6351.             char *from;     file to copy
  6352.             char *to;       destination of copy operation - may be a file name
  6353.                             or a directory
  6354.             int over;       overwrite permission, TRUE or FALSE
  6355.     
  6356.     
  6357.     DESCRIPTION
  6358.     
  6359.     The fcopy() function copies files just like the DOS COPY command. It also
  6360.     suffers some of the same limitations, e.g. the inability to overwrite
  6361.     protected files. It adds the extra security feature of requiring
  6362.     permission to overwrite an existing file.
  6363.     
  6364.     
  6365.     EXAMPLE
  6366.     
  6367.             char *file="FILE.EXT", *dest1="NEW_NAME.$$$", *dest2="NEW_DIR";
  6368.             if (SUCCESS != fcopy(file,dest1,FALSE))
  6369.             {       printf("Can't copy %s to %s\n", file, dest1);
  6370.                     if (SUCCESS == fcopy(file,dest1,TRUE))
  6371.                             puts("It already existed, but it's history now");
  6372.             }
  6373.             if (SUCCESS != fcopy(file,dest2,FALSE))
  6374.                     printf("Can't copy %s to directory %s\n", file, dest2);
  6375.     
  6376.     
  6377.     SEE ALSO: rename()
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403. FCRYPT.FNC - Thu 23 Nov 89 00:20 - Page 98:  
  6404.  
  6405.     NAME
  6406.     
  6407.             crypt_install -- install a stream encryption filter
  6408.     
  6409.     
  6410.     PROTOTYPED IN:  mflfiles.h
  6411.     
  6412.     
  6413.     SYNOPSIS
  6414.     
  6415.             r = crypt_install(stream,key,lvl);
  6416.             int r;          SUCCESS or ERROR
  6417.             SFILE *stream;  stream to be filtered
  6418.             char *key;      encryption/decryption key
  6419.             int lvl;        zero for equivalence with crypt(), else the number
  6420.                             of unique characters (1-26) required in the key
  6421.     
  6422.     
  6423.     DESCRIPTION
  6424.     
  6425.     The crypt_install() function is a special-purpose stream filter which
  6426.     allows data being read from or written to a stream to be encypted or
  6427.     decrypted "on the fly" transparently to the user. The sfinstall() function
  6428.     is called internally by crypt_install().
  6429.     
  6430.     
  6431.     EXAMPLE
  6432.     
  6433.             SFILE *infile;
  6434.     
  6435.             infile = sfopen("file.ext", "r");   /* input from a file      */
  6436.             crypt_install(infile, "keytxt", 0); /* encrypt using "keytxt" */
  6437.             sfinstall(infile, ucase_filt);      /* after converting to UC */
  6438.     
  6439.     
  6440.     SEE ALSO: crypt(), cryptqual(), sfopen(), scopen(), sclose(),
  6441.               sfinstall(), ucase_filt, lcase_filt
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469. FILLCH.FNC - Thu 23 Nov 89 00:20 - Page 99:  
  6470.  
  6471.     NAME
  6472.     
  6473.             fillch -- fill a string with a character
  6474.     
  6475.     
  6476.     PROTOTYPED IN:  mflstrng.h
  6477.     
  6478.     
  6479.     SYNOPSIS
  6480.     
  6481.             void fillch(dest, chr, qty);
  6482.             char *dest      destination string
  6483.             char chr        character to place
  6484.             int qty         number to place
  6485.     
  6486.     DESCRIPTION
  6487.     
  6488.     This function fills string "dest" with "qty" number of characters
  6489.     "chr".  The destination string must be large enough to hold the
  6490.     indicated quantity, as no check is made. In addition, a NULL
  6491.     is not placed after the last character.
  6492.     
  6493.     
  6494.     EXAMPLE
  6495.             char string[20];
  6496.             fillch(string, 'A', 19);
  6497.             string[20] = NULL;
  6498.     
  6499.             makes a usable string of 19 "A" characters.
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535. FLN_FIX.FNC - Thu 23 Nov 89 00:20 - Page 100:  
  6536.  
  6537.     NAME
  6538.     
  6539.             fln_fix  -- remove "dot" directories from pathnames
  6540.     
  6541.     
  6542.     PROTOTYPED IN:  mflfiles.h
  6543.     
  6544.     
  6545.     SYNOPSIS
  6546.     
  6547.              path = fln_fix(path);
  6548.              char *path;     pathname to "scrunch"
  6549.     
  6550.     
  6551.     DESCRIPTION
  6552.     
  6553.     fln_fix() is called internally by flnorm() and can be used alone
  6554.     though it is a somewhat dumber, yet still useful function than
  6555.     flnorm(). Simply, fln_fix(), when passed a filename, ignores the drive
  6556.     designation (i.e. "D:") and returns the same pathname, processed in
  6557.     place, with all "dot" directories scrunched out. Note that fln_fix()
  6558.     has no error return condition and always tries to fix whatever
  6559.     filename it's passed. Basically, fln_fix() does the following:
  6560.     
  6561.         1. Ignores all leading drive specs including network specs where
  6562.            the colon (":") may not be the second character.
  6563.         2. Calls unix2dos() to convert Unix-style filenames (i.e. using
  6564.            the "/" character as a path separator) to DOS-style.
  6565.         3. Leading backslashes, indicating the root directory are ignored.
  6566.            If the root directory is specified, parent directory (double-
  6567.            dot - "..") subdirectories are ignored.
  6568.         4. Any doubled backslashes are converted to single backslashes.
  6569.         5. Single dot (".") directories are scrunched.
  6570.         6. Embedded double-dot directories are scrunched to remove the
  6571.            preceding redundant level.
  6572.         7. Trailing backslashes are preserved.
  6573.          Also internally, the flnorm() function calls unix2dos() which
  6574.         simply converts Unix-style path names (using '/' as the path
  6575.         separator) to DOS-style (using '\' as the path separator).
  6576.     
  6577.     
  6578.     EXAMPLE
  6579.     
  6580.         char norml[MAX_FLEN];    /* defined in MFLDEFS.H */
  6581.         if(flnorm(".\\..\\xyz\\..\\abc\\pdq",char_norml) {
  6582.                 puts("unable to normalize filename");
  6583.         /* NOTE: even if pdq doesn't exist, if the rest of the
  6584.                  path can be normalized, "\PDQ" will be
  6585.                  appended and no error will be returned  */
  6586.     
  6587.         if(flnorm(".\\..\\xyz\\..\\abc\\pdq\\",char_norml) {
  6588.                 puts("bad path or not a directory");
  6589.          puts(fln_fix("abc/123.4:/stuff/../.././junk/./garbage");
  6590.         /*  Prints "abc/123.4:\JUNK\GARBAGE"             */
  6591.          puts(unix2dos("unix_dos/style/path/name.ext"));
  6592.         /*  Prints "UNIX_DOS\STYLE\PATH\NAME.EXT"        */
  6593.     
  6594.     
  6595.     SEE ALSO: flnorm(), unix2dos()
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601. FLNORM.FNC - Thu 23 Nov 89 00:20 - Page 101:  
  6602.  
  6603.     NAME
  6604.     
  6605.             flnorm  -- normalize a filename
  6606.     
  6607.     
  6608.     PROTOTYPED IN:  mflfiles.h
  6609.             
  6610.             
  6611.     PORTABILITY: flnorm() is similar to functions included in many
  6612.                  standard libraries as well as many 3rd party libraries.
  6613.                  Many of thes functions, however, rely on DOS calls
  6614.                  introduced with DOS 3.0 and will therefore not work on
  6615.                  systems running DOS 2.xx.
  6616.     
  6617.     
  6618.     SYNOPSIS
  6619.     
  6620.             r = flnorm(path,norml);
  6621.             int r;          returns zero if valid, else ERROR
  6622.             char *path;     pathname to normalize
  6623.             char *norml;    buffer to receive normalized name
  6624.     
  6625.     
  6626.     DESCRIPTION
  6627.     
  6628.     DOS allows filenames and pathnames to be specified in a bewildering
  6629.     variety of ways. Drive letters are optional, the two types of "dot"
  6630.     directories may be freely interspersed in the name, and the path may
  6631.     either be referenced to the current directory or the root. The primary
  6632.     function of flnorm() is to determine if a file MAY exist. The drive
  6633.     and path (if present) are validated to see if the named file may be
  6634.     created or opened. As a secondary function, path names passed to
  6635.     flnorm() with a trailing path delimiter ('\' or '/') are further
  6636.     validated to verify that they exist and are directories.
  6637.     
  6638.     Specifically, flnorm() "normalizes" file/path names according to the
  6639.     following rules:
  6640.     
  6641.     1. Filenames are first checked to see if they exist.
  6642.     2. If a drive is specified, drvalid() is called to
  6643.        verify it.
  6644.     3. If the filename doesn't exist, but is on a valid drive,
  6645.        the pathname is extracted and it is checked.
  6646.     4. If the pathname is valid, it is normalized and the
  6647.        file name reattached.
  6648.     5. If the specified filename ends in a "\", it is assumed to
  6649.        be a directory. If a file of the specified name is found,
  6650.        an error is returned.
  6651.     6. If nothing in the filename may be verified, an error
  6652.        status is returned and the return filename is blanked.
  6653.     
  6654.     The normalized filename is always of the form "D:\PATH\FILE"
  6655.     even if "FILE" is specified as and found to be a directory.
  6656.     A dangling "\" is only returned for the root directory.
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667. FLNORM.FNC - Thu 23 Nov 89 00:20 - Page 102:  
  6668.  
  6669.  
  6670.     EXAMPLE
  6671.     
  6672.            char norml[MAX_FLEN];    /* defined in MFLDEFS.H */
  6673.            if(flnorm(".\\..\\xyz\\..\\abc\\pdq",char_norml) {
  6674.                    puts("unable to normalize filename");
  6675.            /* NOTE: even if pdq doesn't exist, if the rest of the
  6676.                     path can be normalized, "\PDQ" will be
  6677.                     appended and no error will be returned  */
  6678.            
  6679.            if(flnorm(".\\..\\xyz\\..\\abc\\pdq\\",char_norml) {
  6680.                    puts("bad path or not a directory");
  6681.     
  6682.     
  6683.     SEE ALSO: fln_fix, unix2dos
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689.  
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733. FLREMVOL.FNC - Thu 23 Nov 89 00:20 - Page 103:  
  6734.  
  6735.     NAME
  6736.     
  6737.             flremvol -- removes the volume label on a specified disk drive
  6738.     
  6739.     
  6740.     PROTOTYPED IN:  mflfiles.h
  6741.     
  6742.     
  6743.     PORTABILITY: Compatible with Blaise (tm) library functions of the same
  6744.                  name.
  6745.     
  6746.     
  6747.     SYNOPSIS
  6748.     
  6749.             r = flremvol(drv);
  6750.             int r;          SUCCESS or ERROR
  6751.             char drv;       the drive letter (A-Z, a-z) whose volume label to
  6752.                             remove 
  6753.     
  6754.     
  6755.     DESCRIPTION
  6756.     
  6757.     The flremvol() function removes the volume label from any valid disk drive.
  6758.     
  6759.     
  6760.     EXAMPLE
  6761.     
  6762.             if (ERROR == flremvol('C'))
  6763.                     puts("cant remove volume label from drive C:");
  6764.     
  6765.     
  6766.     SEE ALSO: flretvol(), flsetvol()
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799. FLRETVOL.FNC - Thu 23 Nov 89 00:20 - Page 104:  
  6800.  
  6801.     NAME
  6802.     
  6803.             flretvol -- get the volume label for a disk drive
  6804.     
  6805.     
  6806.     PROTOTYPED IN:  mflfiles.h
  6807.     
  6808.     
  6809.     PORTABILITY: Compatible with Blaise (tm) library functions of the same
  6810.                  name.
  6811.     
  6812.     
  6813.     SYNOPSIS
  6814.     
  6815.             r = flretvol(drv);
  6816.             char *r;        the volume label or NULL if no label or an error
  6817.             char drv;       the drive letter to check (A-Z, a-z)
  6818.     
  6819.     
  6820.     DESCRIPTION
  6821.     
  6822.     The flretvol() function retrieves the volume label for any valid disk
  6823.     drive. The returned volume label will be an ASCIIZ string, 1-11 characters
  6824.     long, uppercase, and without the usual filename period between the 8th and
  6825.     9th characters.
  6826.     
  6827.     
  6828.     EXAMPLE
  6829.     
  6830.             char *vlbl;
  6831.             if (NULL == (vlbl = flretvol('C')))
  6832.                     puts("cant retrieve volume label from drive C:");
  6833.             else    printf("volume label of C: is %s\n", vlbl);
  6834.     
  6835.     
  6836.     SEE ALSO: flremvol(), flsetvol()
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865. FLSETVOL.FNC - Thu 23 Nov 89 00:20 - Page 105:  
  6866.  
  6867.     NAME
  6868.     
  6869.             flsetvol -- sets the volume label on a specified disk drive
  6870.     
  6871.     
  6872.     PROTOTYPED IN:  mflfiles.h
  6873.     
  6874.     
  6875.     PORTABILITY: Compatible with Blaise (tm) library functions of the same
  6876.                  name.
  6877.     
  6878.     
  6879.     SYNOPSIS
  6880.     
  6881.             r = flsetvol(drv,vlbl);
  6882.             int r;          SUCCESS or ERROR
  6883.             char drv;       the drive letter (A-Z, a-z) whose volume label to
  6884.                             set
  6885.             char *vlbl;     new volume label to set
  6886.     
  6887.     
  6888.     DESCRIPTION
  6889.     
  6890.     The flsetvol() function set the volume label on any valid disk drive. If a
  6891.     volume label already exists for that drive, it is deleted. The specified
  6892.     label may be upper or lower case, but will be converted to upper case by
  6893.     DOS.
  6894.     
  6895.     
  6896.     EXAMPLE
  6897.     
  6898.             if (ERROR == flsetvol('C',"new_label"))
  6899.                     puts("cant set volume label on drive C:");
  6900.     
  6901.     
  6902.     SEE ALSO: flretvol(), flremvol()
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.  
  6930.  
  6931. FNMERGE.FNC - Thu 23 Nov 89 00:20 - Page 106:  
  6932.  
  6933.     NAME
  6934.     
  6935.             fnmerge  -- merge drive/path/file/ext into a file string
  6936.     
  6937.     
  6938.     PROTOTYPED IN:  mflfiles.h
  6939.     
  6940.     
  6941.     PORTABILITY: fnmerge() is a superset of a function of the same name
  6942.                  available in and TC
  6943.     
  6944.     
  6945.     SYNOPSIS
  6946.     
  6947.             void fnmerge(s1,s2,s3,s4,s5,s6,s7);
  6948.             char *s1;      buffer for file string
  6949.             char *s2;      drive
  6950.             char *s3;      drive+path
  6951.             char *s4;      path
  6952.             char *s5;      name+ext
  6953.             char *s6;      name
  6954.             char *s7;      ext
  6955.     
  6956.     
  6957.     DESCRIPTION
  6958.     
  6959.     The fnmerge() function takes the same sort of arguments as
  6960.     fnsplit() and merges them to create a file name string. Note that
  6961.     not all inputs are required. For example, if the drive+path is
  6962.     given, the individual drive and path specs are ignored. This
  6963.     assures compatibility with basename(). If the name+ext spec is
  6964.     given, the individual name and extension specs are ignored.
  6965.     If a path is give, either individually or included with a drive
  6966.     spec, and does not include a terminating '\', one is appended. If
  6967.     a separate extension spec is given, it may include a leading '.'
  6968.     or not - one will be added if not. Finally, fnmerge() calls
  6969.     unix2dos() to convert all embedded '/'s into '\'s. As with fnsplit,
  6970.     other compiler implementations may be mimicked with macros.
  6971.     
  6972.     
  6973.     EXAMPLE
  6974.     
  6975.          char file[MAX_FLEN];
  6976.          char *pname = "c:/use/this";
  6977.          char *drive = "z:";
  6978.          char *path  = "not/this/";
  6979.          char *fname = NULL;        /* or = "";                     */
  6980.          char *name  = "name";
  6981.          char *ext   = "ext";       /* leading '.' is optional      */
  6982.     
  6983.          fnmerge(file,drive,pname,path,fname,name,ext);
  6984.     
  6985.          after execution file is "C:\USE\THIS\NAME.EXT"
  6986.     
  6987.     
  6988.     SEE ALSO: basename(), fnsplit()
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997. FNSPLIT.FNC - Thu 23 Nov 89 00:20 - Page 107:  
  6998.  
  6999.     NAME
  7000.     
  7001.             fnsplit  -- split a string into drive/path/file/ext
  7002.     
  7003.     
  7004.     PROTOTYPED IN:  mflfiles.h
  7005.     
  7006.     
  7007.     PORTABILITY: fnsplit() is a superset of a function of the same name
  7008.                  available in and TC
  7009.     
  7010.     
  7011.     SYNOPSIS
  7012.     
  7013.             r=fnsplit(s1,s2,s3,s4,s5,s6,s7);
  7014.             int r;         bit map of file string features
  7015.                            bit 0 - Extension was specified
  7016.                            bit 1 - Filename was specified
  7017.                            bit 2 - Directory was specified
  7018.                            bit 3 - Drive was specified
  7019.                            bit 4 - Wildcards were specified in filename
  7020.                            bit 5 - Wildcards were specified in path
  7021.             char *s1;      original string
  7022.             char *s2;      destination for drive
  7023.             char *s3;      destination for drive+path
  7024.             char *s4;      destination for path
  7025.             char *s5;      destination for name+ext
  7026.             char *s6;      destination for name
  7027.             char *s7;      destination for ext
  7028.     
  7029.     
  7030.     DESCRIPTION
  7031.     
  7032.     The fnsplit() function requires more setup effort than basename() but
  7033.     returns more information. In addition to ALL of the information
  7034.     returned by basename(), fnsplit() also returns the drive
  7035.     specification and separates the filename into name and extension
  7036.     components. As with basename(), if any component isn't specified, an
  7037.     empty string (i.e. first character = '\0') is returned for that
  7038.     component. As a side effect, fnsplit() calls unix2dos() which
  7039.     converts all '/' characters to '\' characters. A NULL passed for any
  7040.     argument will be ignored, allowing simple macro emulation of other
  7041.     compilers' implementations of fnsplit().
  7042.     
  7043.     Internally, fnsplit() calls has_wild() which checks for the
  7044.     existence of DOS wildcard characters ('*' and '?') in the path and
  7045.     filename portions of the given string.
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063. FNSPLIT.FNC - Thu 23 Nov 89 00:20 - Page 108:  
  7064.  
  7065.  
  7066.     EXAMPLE
  7067.     
  7068.          char *name[] = "C:\looney\bin\wumpus.com";
  7069.          char path[MAX_FLEN], file[13];
  7070.          char drive[3], pname[MAX_FLEN], fname[9], ext[4];
  7071.     
  7072.          fnsplit(name, drive, pname, path, file, fname, ext);
  7073.     
  7074.          after execution, fnsplit returns 0x0f, arrays are as follows:
  7075.             name (unchanged except '/'s converted to '\'s)
  7076.             drive C:
  7077.             pname C:\looney\bin\
  7078.             path  \looney\bin\
  7079.             file  wumpus.com
  7080.             fname wumpus
  7081.             ext   .com
  7082.     
  7083.     
  7084.     SEE ALSO: basename(), fnmerge(), has_wild()
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.  
  7098.  
  7099.  
  7100.  
  7101.  
  7102.  
  7103.  
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129. FOPEND.FNC - Thu 23 Nov 89 00:20 - Page 109:  
  7130.  
  7131.     NAME
  7132.     
  7133.             fopend -- fopen a file in an environment variable
  7134.     
  7135.     
  7136.     PROTOTYPED IN:  mflfiles.h
  7137.     
  7138.     
  7139.     SYNOPSIS
  7140.     
  7141.             fd = fopend(name, mode, envar);
  7142.             FILE *fd;
  7143.             char *name;        filename
  7144.             char *mode;        mode
  7145.             char *envar;       name of environment variable
  7146.     
  7147.     DESCRIPTION
  7148.     
  7149.     This function allows the opening of a file in other than just the
  7150.     current directory.  It will attempt to do the open in the current
  7151.     directory first, and if that fails, will then expand to search
  7152.     according to a a specified environment variable.   fopend will return
  7153.     NULL a pointer upon failure.
  7154.     
  7155.     EXAMPLE
  7156.     
  7157.             FILE *fd;
  7158.     
  7159.             if((fd = fopend("stdio.h", "r", "INCLUDE")) == NULL)
  7160.                       cant("stdio.h");
  7161.                  else puts("stdio.h is open for reading");
  7162.     
  7163.     
  7164.     SEE ALSO fopenp(), fopeng()
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195. FOPENG.FNC - Thu 23 Nov 89 00:20 - Page 110:  
  7196.  
  7197.     NAME
  7198.     
  7199.                 fopeng -- fopend/fopenp combination
  7200.     
  7201.     
  7202.     PROTOTYPED IN:  mflfiles.h
  7203.     
  7204.     
  7205.     SYNOPSIS
  7206.     
  7207.                 fd = fopeng(name, mode, envar);
  7208.                 FILE *fd; char *name;        filename char *mode;
  7209.                 mode char *envar;       name of environment variable
  7210.     
  7211.     
  7212.     DESCRIPTION
  7213.     
  7214.     This function allows the opening of a file in other than just the
  7215.     current directory.  It will attempt to do the fopen in the current
  7216.     directory first, and if that fails, will then expand to search by
  7217.     performing a fopend() first and upon failure an fopenp().  See these
  7218.     functions for details.
  7219.     
  7220.     
  7221.     EXAMPLE
  7222.     
  7223.             FILE *fd;
  7224.     
  7225.             if((fd = fopeng("stdio.h", "r", "INCLUDE")) == NULL)
  7226.                       cant("stdio.h");
  7227.             else puts("stdio.h is open for reading");
  7228.     
  7229.     
  7230.     SEE ALSO: fopenp(), fopend()
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261. FOPENP.FNC - Thu 23 Nov 89 00:20 - Page 111:  
  7262.  
  7263.     NAME
  7264.     
  7265.             fopenp -- fopen a file in the PATH
  7266.     
  7267.     
  7268.     PROTOTYPED IN:  mflfiles.h
  7269.     
  7270.     
  7271.     SYNOPSIS
  7272.     
  7273.             fd = fopenp(name, mode);
  7274.             FILE *fd;
  7275.             char *name;        filename
  7276.             char *mode;        mode
  7277.             char *envar;       name of environment variable
  7278.     
  7279.     DESCRIPTION
  7280.     
  7281.     This function allows the opening of a file in other than just
  7282.     the current directory.  It attempts to do the fopen in the
  7283.     current directory first, and if that fails, will then expand to search
  7284.     along PATH environment variable.  It returns a NULL pointer upon failure.
  7285.     
  7286.     
  7287.     EXAMPLE
  7288.     
  7289.             FILE *fd;
  7290.     
  7291.             if((fd = fopenp("foo.bar", "r")) == NULL) cant("foo.bar");
  7292.             else puts("File is now opened!");
  7293.     
  7294.     
  7295.     SEE ALSO fopend(), fopeng()
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327. FTRUNC.FNC - Thu 23 Nov 89 00:20 - Page 112:  
  7328.  
  7329.     NAME
  7330.     
  7331.             ftrunc -- truncate an fopen'ed file
  7332.     
  7333.     
  7334.     PROTOTYPED IN:  mflfiles.h
  7335.     
  7336.     
  7337.     SYNOPSIS
  7338.     
  7339.             result = ftrunc(fp,posn);
  7340.             int result;     SUCCESS or ERROR
  7341.             FILE *fp;       file descriptor of file to truncate
  7342.             long posn;      size of truncated file
  7343.     
  7344.     
  7345.     DESCRIPTION
  7346.     
  7347.     The ftrunc() function will truncate a file that has been opened as a
  7348.     standard stream.  It will return an ERROR if the truncation length is
  7349.     longer than the existing file.
  7350.     
  7351.     
  7352.     EXAMPLE
  7353.     
  7354.             int fd;
  7355.             FILE *fp;
  7356.             char *fname;
  7357.             long size = 100L;
  7358.             fp = fopen(fname, "wb");
  7359.             ftrunc(fp, size);
  7360.     
  7361.     
  7362.     SEE ALSO: trunc(), truncate()
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  
  7380.  
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.  
  7387.  
  7388.  
  7389.  
  7390.  
  7391.  
  7392.  
  7393. GETCODE.FNC - Thu 23 Nov 89 00:20 - Page 113:  
  7394.  
  7395.     NAME
  7396.     
  7397.             get_code_adr -- get a function address
  7398.     
  7399.     
  7400.     PROTOTYPED IN:  mflsys.h
  7401.     
  7402.     
  7403.     SYNOPSIS
  7404.     
  7405.             void get_code_adr(function, segment, offset);
  7406.             int *function;     name of function
  7407.             int *segment;      destination of segment value
  7408.             int *offset;       destination of offset value
  7409.     
  7410.     
  7411.     DESCRIPTION
  7412.     
  7413.     This function is used to get the absolute segment and offset values
  7414.     for the address of a function within a program. It is useful for
  7415.     installing interrupt handlers and interfacing to assembly language
  7416.     modules.
  7417.     
  7418.     
  7419.     EXAMPLE
  7420.     
  7421.            somefunc() {
  7422.                     }
  7423.     
  7424.            main() {
  7425.              int segment, offset;
  7426.              get_code_adr(&somefunc, &segment, &offset);
  7427.              printf("Address is %x:%x\n", segment, offset);
  7428.              }
  7429.     
  7430.     
  7431.     SEE ALSO: get_data_adr()
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459. GETDATA.FNC - Thu 23 Nov 89 00:20 - Page 114:  
  7460.  
  7461.     NAME
  7462.     
  7463.             get_data_adr -- get a data item address
  7464.     
  7465.     
  7466.     PROTOTYPED IN:  mflsys.h
  7467.     
  7468.     
  7469.     SYNOPSIS
  7470.     
  7471.             void get_data_adr(item, offset, segment);
  7472.             int *item;         name of data item
  7473.             int *offset;       destination of offset value
  7474.             int *segment;      destination of segment value
  7475.     
  7476.     
  7477.     DESCRIPTION
  7478.     
  7479.     This function is used to get the absolute segment and offset values
  7480.     for the address of a data item within a program. It is useful for
  7481.     installing interrupt handlers and interfacing to assembly language
  7482.     modules.
  7483.     
  7484.     
  7485.     EXAMPLE
  7486.     
  7487.            int somenumber;
  7488.     
  7489.            main() {
  7490.              int segment, offset;
  7491.              get_data_adr(&somenumber, &offset, &segment);
  7492.              printf("Address is %x:%x\n", segment, offset);
  7493.              }
  7494.     
  7495.     
  7496.     SEE ALSO: get_code_adr()
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.  
  7505.  
  7506.  
  7507.  
  7508.  
  7509.  
  7510.  
  7511.  
  7512.  
  7513.  
  7514.  
  7515.  
  7516.  
  7517.  
  7518.  
  7519.  
  7520.  
  7521.  
  7522.  
  7523.  
  7524.  
  7525. GETDRV.FNC - Thu 23 Nov 89 00:20 - Page 115:  
  7526.  
  7527.     NAME
  7528.     
  7529.             getdrv  -- return default drive
  7530.     
  7531.     
  7532.     PROTOTYPED IN:  mflfiles.h
  7533.     
  7534.     
  7535.     SYNOPSIS
  7536.     
  7537.             r = chdrv(drive);
  7538.             int r;          returns ERROR if drive is invalid
  7539.             char drive;     drive ('A' - 'Z') to check
  7540.     
  7541.     
  7542.     DESCRIPTION
  7543.     
  7544.     Getdrv() is an analog of the getcwd() function which returns the
  7545.     default drive letter rather than the default directory.
  7546.     
  7547.     Note that the drive letter returned by getdrv() is always upper case.
  7548.     
  7549.     
  7550.     EXAMPLE
  7551.     
  7552.             char drive;
  7553.     
  7554.             printf("currently on drive %c:\n", drive = getdrv());
  7555.             if ('C' != drive) {
  7556.                 if (!chdrv('C'))
  7557.                     puts("changed to drive C:");
  7558.                 else puts("\aunable to change drives");
  7559.             }
  7560.     
  7561.     
  7562.     SEE ALSO: drvalid(), chdrv()
  7563.  
  7564.  
  7565.  
  7566.  
  7567.  
  7568.  
  7569.  
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585.  
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591. GETFT.FNC - Thu 23 Nov 89 00:20 - Page 116:  
  7592.  
  7593.     NAME
  7594.     
  7595.             get_filetime -- get file date/time stamp
  7596.     
  7597.     
  7598.     PROTOTYPED IN:  mfltime.h
  7599.     
  7600.     
  7601.     SYNOPSIS
  7602.     
  7603.             #include <time.h>
  7604.             void get_filetime(ptm, fh);
  7605.             struct tm *ptm;     pointer to tm structure
  7606.             int fh;             file handle of opened file
  7607.     
  7608.     
  7609.     DESCRIPTION
  7610.     
  7611.     The get_filetime() function fteches the date/time of a file.  The data
  7612.     from the file is placed in the specified time structure (see "time.h"),
  7613.     in the same format as used by other time functions by.  The file must be
  7614.     opened, and a file handle passed, NOT a FILE pointer.  No error is
  7615.     returned from this function.  The structure elements tm_wday and tm_yday
  7616.     are always returned as 1, as they are generally irrelevant for file
  7617.     dates.  They can subsequently be calculated from the other information.
  7618.             
  7619.     
  7620.     EXAMPLE
  7621.     
  7622.         #include <time.h>
  7623.         #include <mflfiles.h>
  7624.         FILE *fp;
  7625.         char *string;
  7626.         struct tm *stamp;
  7627.     
  7628.         /* report the date/time of a specified file on command line */
  7629.     
  7630.         main(int argc, char *argv[])
  7631.         {
  7632.             if(2 != argc)
  7633.                 exit(0);
  7634.             if(NULL == (fd = fopen(argv[1], "r")))
  7635.                 exit(0);
  7636.     
  7637.             /* note conversion of FILE *fd to file handle next: */
  7638.     
  7639.             get_filetime(stamp, (fileno(fd)));
  7640.             fclose(fd);
  7641.             string = asctime(stamp);
  7642.             printf("File %s modified on %s\n", argv[1], string);
  7643.         }
  7644.     
  7645.     
  7646.     SEE ALSO: getftime()
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.  
  7656.  
  7657. GETFTIME.FNC - Thu 23 Nov 89 00:20 - Page 117:  
  7658.  
  7659.     NAME
  7660.     
  7661.             getftime -- get a file's time/date stamp
  7662.     
  7663.     
  7664.     PROTOTYPED IN:  mfltime.h
  7665.     
  7666.     
  7667.     PORTABILITY: TC
  7668.     
  7669.     
  7670.     SYNOPSIS
  7671.     
  7672.             r = getftime(fh, t);
  7673.             int r;           returns 0 if successful, else -1 and sets
  7674.                              errno
  7675.             int fh;          handle of file to check
  7676.             struct ftime *t; pointer to file time/date stamp structure
  7677.     
  7678.     
  7679.     DESCRIPTION
  7680.     
  7681.     This routine retrieves a file's time/date stamp. See MFLTIME.H for a
  7682.     description of the ftime structure.
  7683.     
  7684.     
  7685.     EXAMPLE
  7686.     
  7687.             struct ftime stamp;
  7688.             int fh;
  7689.     
  7690.             fh = open ("file.ext", O_RDONLY);
  7691.             if (ERROR == getftime(fh, &stamp))
  7692.                    puts("can't read time/date stamp");
  7693.             printf("FILE.EXT was @ %02d-%02d-%02d %02d:%02d:%02d\n",
  7694.                    stamp.ft_month, stamp.ft_day, stamp.ft_year + 80,
  7695.                    stamp.ft_hour, stamp.ft_min, stamp.ft_tsec * 2);
  7696.     
  7697.     
  7698.     SEE ALSO: setftime, touch, get_filetime
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.  
  7712.  
  7713.  
  7714.  
  7715.  
  7716.  
  7717.  
  7718.  
  7719.  
  7720.  
  7721.  
  7722.  
  7723. GETKEY.FNC - Thu 23 Nov 89 00:20 - Page 118:  
  7724.  
  7725.     NAME
  7726.     
  7727.             getkey -- extended keyboard fetch
  7728.     
  7729.     
  7730.     PROTOTYPED IN:  mflconio.h
  7731.     
  7732.     
  7733.     SYNOPSIS
  7734.     
  7735.             #include "keys.h"
  7736.             r = getkey();
  7737.             int r;          returns keyboard value
  7738.     
  7739.     
  7740.     DESCRIPTION
  7741.     
  7742.     This function eases the reading of all keys, whether normal
  7743.     or function keys.  The getch() function is used to return a keyboard
  7744.     value.  If the first value received is 0, then a second value
  7745.     is fetched and 256 (0x100) is added to flag the return value
  7746.     as an extended function key.  The calling program should check
  7747.     for a return value greater than 255.  If true, subtract 256 (or
  7748.     "and" with 0xff) and consider the result as a function key.
  7749.     Most function keys are defined in keys.h, and others may be user added.
  7750.     
  7751.     
  7752.     EXAMPLE
  7753.     
  7754.           This example tests for function key 3 (FK3)
  7755.     
  7756.           #include "keys.h"
  7757.           int r;
  7758.     
  7759.           while(TRUE) {
  7760.              r = getkey();
  7761.              if(r < 256) {
  7762.                 printf("Not FK3 key");
  7763.                 continue;
  7764.                 }
  7765.              else r &= 0xff;
  7766.              if(r == FK3) printf("FK3 sensed!!!");
  7767.              }
  7768.  
  7769.  
  7770.  
  7771.  
  7772.  
  7773.  
  7774.  
  7775.  
  7776.  
  7777.  
  7778.  
  7779.  
  7780.  
  7781.  
  7782.  
  7783.  
  7784.  
  7785.  
  7786.  
  7787.  
  7788.  
  7789. GETPATH.FNC - Thu 23 Nov 89 00:20 - Page 119:  
  7790.  
  7791.     NAME
  7792.     
  7793.             getpath -- retrieve the PATH variable and parse
  7794.     
  7795.     
  7796.     PROTOTYPED IN:  mflfiles.h
  7797.     
  7798.     
  7799.     SYNOPSIS
  7800.     
  7801.             c = getpath(string);
  7802.             int c;          count of characters returned in string
  7803.             char *string[]; destination for parsed string. Minimum 128
  7804.                             bytes, but longer paths could clobber this.
  7805.     
  7806.     DESCRIPTION
  7807.     
  7808.     This function extracts the PATH variable (if it exists) and makes
  7809.     a "pseudo-array" at destination string.  All semi-colon separators
  7810.     are replaced by NULL bytes.  The returned integer count totals
  7811.     all characters inserted into the string including NULLS, and
  7812.     should be used to determine the exact end of the string, since
  7813.     a NULL byte will not determine this.
  7814.     
  7815.     
  7816.     EXAMPLE
  7817.     
  7818.             char *string[135];
  7819.             int count;
  7820.             count = getpath(string);
  7821.     
  7822.             count will return as zero if no PATH is found.
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.  
  7851.  
  7852.  
  7853.  
  7854.  
  7855. GETPOS.FNC - Thu 23 Nov 89 00:20 - Page 120:  
  7856.  
  7857.     NAME
  7858.     
  7859.             getpos -- get current cursor position
  7860.     
  7861.     
  7862.     PROTOTYPED IN:  mflconio.h
  7863.     
  7864.     
  7865.     SYNOPSIS
  7866.     
  7867.             position = getpos(page);
  7868.             unsigned int position;      returned position
  7869.             int page;          video page to check
  7870.     
  7871.     
  7872.     DESCRIPTION
  7873.     
  7874.     Returns the row and column of the cursor on the specified
  7875.     video page.  Row is in upper 8 bits of returned integer
  7876.     and column in lower 8 bits.  Values are in binary.
  7877.     
  7878.     
  7879.     EXAMPLE
  7880.     
  7881.            unsigned int position;
  7882.            short row, column;
  7883.            position = getpos(0);    /* on video page 0 */
  7884.            row = (position >> 8) & 0xff;
  7885.            column = position & 0xff;
  7886.     
  7887.     
  7888.     SEE ALSO: d_pos()
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  7913.  
  7914.  
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921. GETPREES.FNC - Thu 23 Nov 89 00:20 - Page 121:  
  7922.  
  7923.     NAME
  7924.     
  7925.             get_press -- get waiting keypress
  7926.     
  7927.     
  7928.     PROTOTYPED IN:  mflsys.h
  7929.     
  7930.     
  7931.     SYNOPSIS
  7932.     
  7933.             r = get_press();          get waiting keypress
  7934.             unsigned char r;          key value
  7935.     
  7936.     
  7937.     DESCRIPTION
  7938.     
  7939.     This is part of a series of functions is used to read and debounce the
  7940.     four switch inputs on the joystick input port.  The
  7941.     analog joystick inputs are not supported.
  7942.     
  7943.     get_press() is called to return any fully debounced input. A value of
  7944.     0 indicates no input available.
  7945.     
  7946.     Switch values are returned as an 8 bit value, with only the lowest 4
  7947.     bits in use.  A set bit indicates a closed switch. If multiple
  7948.     keystrokes are not allowed, then get_press() will return 0, 1, 2, 4,
  7949.     or 8.  If multiples are allowed, then all values 0-15 (0-0x0f) may be
  7950.     returned.
  7951.     
  7952.             bit position            pin number on connector
  7953.                    0                            2
  7954.                    1                            7
  7955.                    2                            14
  7956.                    3                            10
  7957.     
  7958.     
  7959.     EXAMPLE
  7960.     
  7961.             main() {
  7962.                 unsigned char i;
  7963.                 init_game(FALSE);    /* allow only single switch inputs */
  7964.                 for ever() {
  7965.                     debounce();       /* call this regularly */
  7966.                     i = get_press();
  7967.                     if(i is 0) continue;
  7968.                     printf("switch value is %x\n", i);
  7969.                 }
  7970.            }
  7971.     
  7972.     
  7973.     SEE ALSO: init_game(), clear_game(), debounce()
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987. GETPRESS.FNC - Thu 23 Nov 89 00:20 - Page 122:  
  7988.  
  7989.     NAME
  7990.     
  7991.             get_press -- get waiting keypress
  7992.     
  7993.     
  7994.     PROTOTYPED IN:  mflsys.h
  7995.     
  7996.     
  7997.     SYNOPSIS
  7998.     
  7999.             r = get_press();          get waiting keypress
  8000.             unsigned char r;          key value
  8001.     
  8002.     
  8003.     DESCRIPTION
  8004.     
  8005.     This is part of a series of functions is used to read and debounce the
  8006.     four switch inputs on the joystick input port.  The
  8007.     analog joystick inputs are not supported.
  8008.     
  8009.     get_press() is called to return any fully debounced input. A value of
  8010.     0 indicates no input available.
  8011.     
  8012.     Switch values are returned as an 8 bit value, with only the lowest 4
  8013.     bits in use.  A set bit indicates a closed switch. If multiple
  8014.     keystrokes are not allowed, then get_press() will return 0, 1, 2, 4,
  8015.     or 8.  If multiples are allowed, then all values 0-15 (0-0x0f) may be
  8016.     returned.
  8017.     
  8018.             bit position            pin number on connector
  8019.                    0                            2
  8020.                    1                            7
  8021.                    2                            14
  8022.                    3                            10
  8023.     
  8024.     
  8025.     EXAMPLE
  8026.     
  8027.             main() {
  8028.                 unsigned char i;
  8029.                 init_game(FALSE);    /* allow only single switch inputs */
  8030.                 for ever() {
  8031.                     debounce();       /* call this regularly */
  8032.                     i = get_press();
  8033.                     if(i is 0) continue;
  8034.                     printf("switch value is %x\n", i);
  8035.                 }
  8036.            }
  8037.     
  8038.     
  8039.     SEE ALSO: init_game(), clear_game(), debounce()
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053. GETPRTSC.FNC - Thu 23 Nov 89 00:20 - Page 123:  
  8054.  
  8055.     NAME
  8056.     
  8057.             getPrtSc_stat -- retrieves status of last PrtSc operation
  8058.     
  8059.     
  8060.     PROTOTYPED IN:  mflsys.h
  8061.     
  8062.     
  8063.     SYNOPSIS
  8064.     
  8065.             r = getPrtSc_stat();
  8066.             int r;          0 if successful,
  8067.                             1 if screen printing is already in process,
  8068.                            -1 if the last screen print operation failed
  8069.     
  8070.     
  8071.     DESCRIPTION
  8072.     
  8073.     The getPrtSc_stat() function checks on the activity of any previous calls
  8074.     to PrtSc().
  8075.     
  8076.     
  8077.     EXAMPLE
  8078.     
  8079.             if (0 == getPrtSc_stat()) /* make sure not already printing */
  8080.                     PrtSc();
  8081.     
  8082.     
  8083.     SEE ALSO: PrtSc()
  8084.  
  8085.  
  8086.  
  8087.  
  8088.  
  8089.  
  8090.  
  8091.  
  8092.  
  8093.  
  8094.  
  8095.  
  8096.  
  8097.  
  8098.  
  8099.  
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.  
  8117.  
  8118.  
  8119. GTODFUNC.FNC - Thu 23 Nov 89 00:20 - Page 124:  
  8120.  
  8121.     NAME
  8122.     
  8123.             gtodsub -- Get time of day to file pointer
  8124.     
  8125.     
  8126.     PROTOTYPED IN:  mfltime.h
  8127.     
  8128.     
  8129.     SYNOPSIS
  8130.     
  8131.             void gtodsub(fp);
  8132.             FILE *fp;
  8133.             void gtodstr(str);
  8134.             char *str;
  8135.     
  8136.     
  8137.     DESCRIPTION
  8138.     
  8139.     This function reads the system date and time and sends them in a
  8140.     formatted string to the specified output channel, or to a string.
  8141.     
  8142.     
  8143.     EXAMPLE
  8144.      
  8145.             gtodsub(stdout);   /* send date/time to stdout */
  8146.     
  8147.             char string[30];
  8148.             gtodstr(string);
  8149.             printf("date and time are %s\n", string);  /* same result */
  8150.     
  8151.     
  8152.     SEE ALSO: gtodstr
  8153.  
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179.  
  8180.  
  8181.  
  8182.  
  8183.  
  8184.  
  8185. GTODSTR.FNC - Thu 23 Nov 89 00:20 - Page 125:  
  8186.  
  8187.     NAME
  8188.     
  8189.             gtodstr -- Get time of day to a string
  8190.     
  8191.     
  8192.     PROTOTYPED IN:  mfltime.h
  8193.     
  8194.     
  8195.     SYNOPSIS
  8196.     
  8197.             void gtodstr(str);
  8198.             char *str;
  8199.     
  8200.     
  8201.     DESCRIPTION
  8202.     
  8203.     This function reads the system date and time and sends them in a
  8204.     formatted string to the specified output channel, or to a string.
  8205.     
  8206.     
  8207.     EXAMPLE
  8208.      
  8209.             char string[30];
  8210.             gtodstr(string);
  8211.             printf("date and time are %s\n", string);  /* same result */
  8212.     
  8213.                 
  8214.     SEE ALSO: gtodsub()
  8215.  
  8216.  
  8217.  
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234.  
  8235.  
  8236.  
  8237.  
  8238.  
  8239.  
  8240.  
  8241.  
  8242.  
  8243.  
  8244.  
  8245.  
  8246.  
  8247.  
  8248.  
  8249.  
  8250.  
  8251. GTODSUB.FNC - Thu 23 Nov 89 00:20 - Page 126:  
  8252.  
  8253.     NAME
  8254.     
  8255.             gtodsub -- Get time of day to file pointer
  8256.     
  8257.     
  8258.     PROTOTYPED IN:  mfltime.h
  8259.             
  8260.     
  8261.     SYNOPSIS
  8262.     
  8263.             void gtodsub(fp);
  8264.             FILE *fp;
  8265.     
  8266.     
  8267.     DESCRIPTION
  8268.     
  8269.     This function reads the system date and time and sends them in a
  8270.     formatted string to the specified output channel, or to a string.
  8271.     
  8272.     
  8273.     EXAMPLE
  8274.      
  8275.             gtodsub(stdout);   /* send date/time to stdout */
  8276.     
  8277.     
  8278.     SEE ALSO: gtodstr()
  8279.  
  8280.  
  8281.  
  8282.  
  8283.  
  8284.  
  8285.  
  8286.  
  8287.  
  8288.  
  8289.  
  8290.  
  8291.  
  8292.  
  8293.  
  8294.  
  8295.  
  8296.  
  8297.  
  8298.  
  8299.  
  8300.  
  8301.  
  8302.  
  8303.  
  8304.  
  8305.  
  8306.  
  8307.  
  8308.  
  8309.  
  8310.  
  8311.  
  8312.  
  8313.  
  8314.  
  8315.  
  8316.  
  8317. HAS_WILD.FNC - Thu 23 Nov 89 00:20 - Page 127:  
  8318.  
  8319.     NAME
  8320.     
  8321.             has_wild -- checks a string for DOS wildcards
  8322.     
  8323.     
  8324.     PROTOTYPED IN:  mflfiles.h
  8325.     
  8326.     
  8327.     SYNOPSIS
  8328.     
  8329.             r=has_wild(str);
  8330.             int r;         TRUE if str contains '*' or '?', else FALSE
  8331.             char *str;     string to check
  8332.     
  8333.     
  8334.     DESCRIPTION
  8335.     
  8336.     The has_wild() function checks for the existence of DOS wildcard
  8337.     characters ('*' and '?') in a string. It is used internally by
  8338.     fnsplit().
  8339.     
  8340.     
  8341.     EXAMPLE
  8342.     
  8343.     
  8344.          if (has_wild("TEST.FIL"))  /* returns FALSE                */
  8345.             ...
  8346.          if (has_wild("TE?T.FIL"))  /* returns TRUE                 */
  8347.             ...
  8348.          if (has_wild("TEST*.FIL")) /* returns TRUE                 */
  8349.             ...
  8350.     
  8351.     
  8352.     SEE ALSO: fnsplit()
  8353.  
  8354.  
  8355.  
  8356.  
  8357.  
  8358.  
  8359.  
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381.  
  8382.  
  8383. HSTR_I.FNC - Thu 23 Nov 89 00:20 - Page 128:  
  8384.  
  8385.     NAME
  8386.     
  8387.             hstr_i -- make an ascii hexadecimal string into an integer
  8388.     
  8389.     
  8390.     PROTOTYPED IN:  mflstrng.h
  8391.     
  8392.     
  8393.     SYNOPSIS
  8394.     
  8395.             c = hstr_i(p);
  8396.             char *p;          string of ascii characters
  8397.             unsigned int c;   returned hex value
  8398.     
  8399.     
  8400.     DESCRIPTION
  8401.     
  8402.     Read a string of ascii hexadecimal digits (0-9, A-F) and create
  8403.     an integer from the result.  String must begin with a hex digit.
  8404.     Calculation proceeds to first non-hex digit or NULL terminator.
  8405.     
  8406.     
  8407.     EXAMPLE
  8408.     
  8409.            char string[] = "1A5C*";
  8410.            int result;
  8411.            result = hstr_i(string);
  8412.              /*  result will equal 0x1A5C */
  8413.  
  8414.  
  8415.  
  8416.  
  8417.  
  8418.  
  8419.  
  8420.  
  8421.  
  8422.  
  8423.  
  8424.  
  8425.  
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449. I_DSTR.FNC - Thu 23 Nov 89 00:20 - Page 129:  
  8450.  
  8451.     NAME
  8452.     
  8453.             i_dstr -- make an integer from a decimal ascii string
  8454.     
  8455.     
  8456.     PROTOTYPED IN:  mflstrng.h
  8457.     
  8458.     
  8459.     SYNOPSIS
  8460.     
  8461.             c = i_dstr(p, r);
  8462.             char *p;       destination string pointer
  8463.             int r;         integer to convert
  8464.             int c;         count of characters in string
  8465.     
  8466.     
  8467.     DESCRIPTION
  8468.     
  8469.     Convert an integer into an ascii decimal string (unsigned).
  8470.     Range is that of 16 bits unsigned, or 0-65535.  The function
  8471.     returns the number of characters placed in the string.  The string
  8472.     is NULL terminated, and must be at least six bytes long to
  8473.     accomodate the longest number plus the NULL.  Numbers are assumed
  8474.     to be positive.
  8475.     
  8476.     
  8477.     EXAMPLE
  8478.     
  8479.            char string[6];
  8480.            int count;
  8481.            count = i_dstr(string, 1357);
  8482.              count will equal 4
  8483.              string will be "1357\0"
  8484.  
  8485.  
  8486.  
  8487.  
  8488.  
  8489.  
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.  
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515. IBMTYPE.FNC - Thu 23 Nov 89 00:20 - Page 130:  
  8516.  
  8517.     NAME
  8518.     
  8519.             ibmtype -- find out type of computer
  8520.     
  8521.     
  8522.     PROTOTYPED IN:  mflsys.h
  8523.     
  8524.     
  8525.     SYNOPSIS
  8526.     
  8527.             r = ibmtype();
  8528.             int r;   r = 0 for PC or XT, 1 for PC Jr.,
  8529.                      2 for AT, 3 for unknown type
  8530.     
  8531.     
  8532.     DESCRIPTION
  8533.     
  8534.     This function examines the byte in ROM at F000:FFFEh.
  8535.     For real IBM computers, this should be:
  8536.        0xff  PC
  8537.        0xfe  XT
  8538.        0xfd  JR
  8539.        0xfc  AT
  8540.     Many close clones will also encode this byte in the above manner,
  8541.     although there is no requirement for this feature.
  8542.     
  8543.     
  8544.     CAVEAT
  8545.     
  8546.     The results of this test should be taken with a grain of salt
  8547.     the size of Salt Lake City.  Even IBM has shipped XTs with
  8548.     the PC id byte.  The NOVAS AT clone correctly has 0xfc,
  8549.     but the Z-NIX XT clone (which is a very close clone) has 0x05.
  8550.     Don't depend too heavily on the results being really accurate.
  8551.     
  8552.     
  8553.     EXAMPLE
  8554.     
  8555.              r = ibmtype();
  8556.              if(r == 2) printf("This machine is an AT, maybe!");
  8557.  
  8558.  
  8559.  
  8560.  
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.  
  8567.  
  8568.  
  8569.  
  8570.  
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.  
  8579.  
  8580.  
  8581. INDEX.FNC - Thu 23 Nov 89 00:20 - Page 131:  
  8582.  
  8583.     NAME
  8584.     
  8585.             index -- offset of leftmost char in a string
  8586.     
  8587.     
  8588.     DEFINED IN:  mflstrng.h
  8589.     
  8590.     
  8591.     SYNOPSIS
  8592.     
  8593.              r = index(s,c);
  8594.              int r;          offset (index) of leftmost occurance of
  8595.                              char c in string s, -1 if unsuccessful
  8596.              char *s;        string to search
  8597.              char c;         character for which to search
  8598.     
  8599.     
  8600.     DESCRIPTION
  8601.     
  8602.     This function is part of a set of macros included in MFLSTRNG.H.
  8603.     Index returns the leftmost character offset in a string.  Note that
  8604.     index() is available as functions in many systems and may return an
  8605.     integer offset, as done here, or may simply be aliases for strchr()
  8606.     and chrrchr(), respectively. It is provided here to aid portability,
  8607.     but may need to be modified or undefined depending on the original
  8608.     implementation.
  8609.     
  8610.     
  8611.     EXAMPLES
  8612.         
  8613.                 int offset;
  8614.                 offset=index("ABCDEDCBA", 'C');     /* returns 2    */
  8615.                 offset=index("ABCDEDCBA", 'Q');     /* returns -1   */
  8616.     
  8617.     
  8618.     SEE ALSO: rindex()
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.  
  8632.  
  8633.  
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.  
  8646.  
  8647. INITGAME.FNC - Thu 23 Nov 89 00:20 - Page 132:  
  8648.  
  8649.     NAME
  8650.     
  8651.             init_game -- initialize and set game port mode
  8652.     
  8653.     
  8654.     PROTOTYPED IN:  mflsys.h
  8655.     
  8656.     
  8657.     SYNOPSIS
  8658.     
  8659.             (void)init_game(mode);
  8660.     
  8661.     
  8662.     DESCRIPTION
  8663.     
  8664.     This is part of a series of functions used to read and debounce the
  8665.     four switch inputs on the joystick input port.  The analog joystick
  8666.     inputs are not supported. init_game() is called to setup the
  8667.     processor.  If its argument is TRUE, then multiple key inputs are
  8668.     allowed. If FALSE, any multiple key closure will be locked out.
  8669.     
  8670.     The game port was originally intended for playing games via
  8671.     an arcade-style joystick.  However, for the serious engineer,
  8672.     this port is an excellent "quick and dirty" 4 bit TTL level
  8673.     input port.  It may be used for reading external switches,
  8674.     sensors, etc.
  8675.     
  8676.     Switch values are returned as an 8 bit value, with only the
  8677.     lowest 4 bits in use.  A set bit indicates a closed switch.
  8678.     If multiple keystrokes are not allowed, then get_press() will
  8679.     return 0, 1, 2, 4, or 8.  If multiples are allowed, then
  8680.     all values 0-15 (0-0x0f) may be returned.
  8681.     
  8682.          bit position            pin number on connector
  8683.               0                            2
  8684.               1                            7
  8685.               2                            14
  8686.               3                            10
  8687.     
  8688.     
  8689.     EXAMPLE
  8690.     
  8691.                 main() {
  8692.                    unsigned char i;
  8693.                    init_game(FALSE);    /* allow only single switch inputs */
  8694.                    for ever() {
  8695.                       debounce();       /* call this regularly */
  8696.                       i = get_press();
  8697.                       if(i is 0) continue;
  8698.                       printf("switch value is %x\n", i);
  8699.                       }
  8700.                    }
  8701.     
  8702.     
  8703.     SEE ALSO: clear_game(), get_press(), debounce()
  8704.  
  8705.  
  8706.  
  8707.  
  8708.  
  8709.  
  8710.  
  8711.  
  8712.  
  8713. INSTICK.FNC - Thu 23 Nov 89 00:20 - Page 133:  
  8714.  
  8715.     NAME
  8716.     
  8717.             installtick -- install a timer interrupt service routine
  8718.     
  8719.     
  8720.     PROTOTYPED IN:  mfltime.h
  8721.     
  8722.     
  8723.     SYNOPSIS
  8724.     
  8725.             void installtick(&counter);
  8726.             unsigned int counter;     integer to decrement
  8727.     
  8728.     
  8729.     DESCRIPTION
  8730.     
  8731.     "ticker" is not actually a C function, but a routine which is
  8732.     installed on interrupt 1CH.  At each interrupt (18.21 times per
  8733.     second) this routine decrements an integer (16 bits) whose address was
  8734.     passed during installation.  The C program can load and test this
  8735.     integer at any time to perform time-based operations.  When the
  8736.     variable is decremented to zero, it is not decremented any further;
  8737.     i.e., no underflow occurs. Therefore, the integer is actually an
  8738.     unsigned integer with a maximum count of 65535, or (65535/18.2)
  8739.     seconds. installtick() installs the ticker on interrupt 1CH and saves
  8740.     the address of the passed variable. removetick() restores the
  8741.     interrupt 1CH vector to its original state. Any other routines already
  8742.     installed on this vector are executed after ticker, since the ticker
  8743.     chains to the original vector after execution.
  8744.     
  8745.     
  8746.     EXAMPLE
  8747.     
  8748.             int  counter;
  8749.     
  8750.             main() {
  8751.                  installtick(&counter);
  8752.                  counter = 18 * 10;  /* about 10 seconds */
  8753.                  while(counter > 0); /* delay here */
  8754.                  removetick();
  8755.             }
  8756.     
  8757.     
  8758.     CAVEAT
  8759.     
  8760.     It is imperative to call removetick() BEFORE terminating the program,
  8761.     Otherwise, the system will crash!
  8762.     
  8763.     
  8764.     SEE ALSO: ctlbrk(), criterr(), removetick()
  8765.     
  8766.  
  8767.  
  8768.  
  8769.  
  8770.  
  8771.  
  8772.  
  8773.  
  8774.  
  8775.  
  8776.  
  8777.  
  8778.  
  8779. ISCONS.FNC - Thu 23 Nov 89 00:20 - Page 134:  
  8780.  
  8781.     NAME
  8782.     
  8783.             iscons -- is file descriptor the console
  8784.     
  8785.     
  8786.     PROTOTYPED IN:  mflconio.h
  8787.     
  8788.     
  8789.     SYNOPSIS
  8790.     
  8791.             r = iscons(fd);
  8792.             int r;      TRUE or FALSE returned
  8793.             FILE *fd;   file descriptor to check
  8794.     
  8795.     
  8796.     DESCRIPTION
  8797.     
  8798.     The specified file descriptor is tested to see if it refers to the
  8799.     console device.  TRUE (not 0) is returned if it does, and FALSE (0)
  8800.     otherwise. This is a test primarily aimed at detecting if stdin or
  8801.     stdout have been redirected away from the default console.
  8802.     
  8803.     
  8804.     EXAMPLE
  8805.     
  8806.             if(iscons(stdin)) puts("stdin is the keyboard");
  8807.             else ("stdin is probably a file");
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817.  
  8818.  
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.  
  8825.  
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845. ISLEAP.FNC - Thu 23 Nov 89 00:20 - Page 135:  
  8846.  
  8847.     NAME
  8848.     
  8849.             isleap -- check if year is a leap year
  8850.     
  8851.     
  8852.     PROTOTYPED IN:  mfltime.h
  8853.     
  8854.     
  8855.     SYNOPSIS
  8856.     
  8857.             r = isleap(year);
  8858.             unsigned r;     returns TRUE if leapyear, else FALSE
  8859.             unsigned year;  year value
  8860.     
  8861.     
  8862.     DESCRIPTION
  8863.     
  8864.     The isleap() function simply checks the specified year to return a
  8865.     TRUE if the specified year is a leap year.
  8866.     
  8867.     
  8868.     EXAMPLE
  8869.     
  8870.             if(isleap(1986)) printf("This is a leap year");
  8871.             else printf("This is not a leap year");
  8872.     
  8873.     
  8874.     SEE ALSO: ymd_to_julian, julian_to_ymd, julian_to_wkday, julian_to_yrday
  8875.               julian_to_dayname, julian_to_time, julian_to_tm, time_to_julian
  8876.               tm_to_julian
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.  
  8883.  
  8884.  
  8885.  
  8886.  
  8887.  
  8888.  
  8889.  
  8890.  
  8891.  
  8892.  
  8893.  
  8894.  
  8895.  
  8896.  
  8897.  
  8898.  
  8899.  
  8900.  
  8901.  
  8902.  
  8903.  
  8904.  
  8905.  
  8906.  
  8907.  
  8908.  
  8909.  
  8910.  
  8911. ISQRT.FNC - Thu 23 Nov 89 00:20 - Page 136:  
  8912.  
  8913.     NAME
  8914.     
  8915.             isqrt  -- extract integer square root of an int
  8916.     
  8917.     
  8918.     PROTOTYPED IN:  mflmath.h
  8919.     
  8920.     
  8921.     SYNOPSIS
  8922.     
  8923.             result = isqrt(number);
  8924.             int result;           square root (truncated)
  8925.             unsigned number;      number whose square root to extract
  8926.     
  8927.     
  8928.     DESCRIPTION
  8929.     
  8930.     This part of a set of routines provided primarily for embedded systems
  8931.     programmers. These routines extract the square root of either a short or
  8932.     long integer number without the use of floating point math. Versions are
  8933.     provided which will either truncate or round the result. Note that
  8934.     arguments are unsigned so no error checking is done for negative inputs.
  8935.     
  8936.     
  8937.     EXAMPLE
  8938.     
  8939.             int i;
  8940.             for (i = 4; i < 9; ++i)
  8941.             printf("sqrt(%d) = %d, %d\n", i, isqrt(i), isqrtr(i));
  8942.     
  8943.             /* prints:      sqrt(4) = 2, 2
  8944.                             sqrt(5) = 2, 2
  8945.                             sqrt(6) = 2, 2
  8946.                             sqrt(7) = 2, 3
  8947.                             sqrt(8) = 2, 3
  8948.                             sqrt(9) = 3, 3                  */
  8949.     
  8950.     
  8951.     
  8952.     SEE ALSO: isqrtr(), lsqrt(), lsqrtr()
  8953.  
  8954.  
  8955.  
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.  
  8973.  
  8974.  
  8975.  
  8976.  
  8977. ISQRTR.FNC - Thu 23 Nov 89 00:20 - Page 137:  
  8978.  
  8979.     NAME
  8980.     
  8981.             isqrtr -- extract integer square root of an int w/ rounding
  8982.     
  8983.     
  8984.     PROTOTYPED IN:  mflmath.h
  8985.     
  8986.     
  8987.     SYNOPSIS
  8988.     
  8989.              result = isqrtr(number);
  8990.              int result;           square root (rounded)
  8991.              unsigned number;      number whose square root to extract
  8992.     
  8993.     
  8994.     DESCRIPTION
  8995.     
  8996.     This is part of a set of routines provided primarily for embedded
  8997.     systems programmers. These routines extract the square root of either a
  8998.     short or long integer number without the use of floating point math.
  8999.     Versions are provided which will either truncate or round the result.
  9000.     Note that arguments are unsigned so no error checking is done for
  9001.     negative inputs.
  9002.     
  9003.     
  9004.     EXAMPLE
  9005.     
  9006.             int i;
  9007.             for (i = 4; i < 9; ++i)
  9008.             printf("sqrt(%d) = %d, %d\n", i, isqrt(i), isqrtr(i));
  9009.     
  9010.             /* prints:      sqrt(4) = 2, 2
  9011.                             sqrt(5) = 2, 2
  9012.                             sqrt(6) = 2, 2
  9013.                             sqrt(7) = 2, 3
  9014.                             sqrt(8) = 2, 3
  9015.                             sqrt(9) = 3, 3                  */
  9016.     
  9017.     
  9018.     SEE ALSO: isqrt(), lsqrt(), lsqrtr()
  9019.  
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.  
  9027.  
  9028.  
  9029.  
  9030.  
  9031.  
  9032.  
  9033.  
  9034.  
  9035.  
  9036.  
  9037.  
  9038.  
  9039.  
  9040.  
  9041.  
  9042.  
  9043. JUL2DNAM.FNC - Thu 23 Nov 89 00:20 - Page 138:  
  9044.  
  9045.     NAME
  9046.     
  9047.             julian_to_dayname -- convert Julian date to day of the week
  9048.     
  9049.     
  9050.     PROTOTYPED IN:  mfltime.h
  9051.     
  9052.     
  9053.     SYNOPSIS
  9054.     
  9055.             r = julian_to_dayname(julian);
  9056.             char *r;        day of week ("Monday", "Tuesday", etc.)
  9057.             long julian;    Julian (scalar) date
  9058.     
  9059.     
  9060.     DESCRIPTION
  9061.     
  9062.     This function returns a string representing the name of the day on
  9063.     which a given scalar (Julian) date occured. The string returned is
  9064.     taken from the active locale.
  9065.     
  9066.     
  9067.     EXAMPLE
  9068.     
  9069.             long jday;
  9070.     
  9071.             printf("Julian date %ld fell on a %s\n",
  9072.                     jday, julian_to_dayname(jday));
  9073.     
  9074.     
  9075.     SEE ALSO: julian_to_wkday(), setlocale(), localeconv(), ymd_to_julian(),
  9076.               julian_to_ymd(), julian_to_yrday(), julian_to_time(),
  9077.               julian_to_tm(), time_to_julian(), tm_to_julian
  9078.  
  9079.  
  9080.  
  9081.  
  9082.  
  9083.  
  9084.  
  9085.  
  9086.  
  9087.  
  9088.  
  9089.  
  9090.  
  9091.  
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.  
  9098.  
  9099.  
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.  
  9107.  
  9108.  
  9109. JUL2TIME.FNC - Thu 23 Nov 89 00:20 - Page 139:  
  9110.  
  9111.     NAME
  9112.     
  9113.             julian_to_time -- convert Julian date to time_t value
  9114.     
  9115.     
  9116.     PROTOTYPED IN:  mfltime.h
  9117.     
  9118.     
  9119.     SYNOPSIS
  9120.     
  9121.             r = julian_to_time(julian,time);
  9122.             LOGICAL r;      SUCCESS or ERROR if year < 1970
  9123.             long julian;    Julian (scalar) date
  9124.             time_t *time;   date/time to convert
  9125.     
  9126.     
  9127.     DESCRIPTION
  9128.     
  9129.     This function converts scalar (Julian) dates to standard time_t date
  9130.     and time values. Since Julian dates do not contain time information,
  9131.     the time is reset to midnight.
  9132.     
  9133.     
  9134.     EXAMPLE
  9135.     
  9136.             long jday;
  9137.             time_t time;
  9138.     
  9139.             if (ERROR == julian_to_time(jday, &time))
  9140.                     puts("Can't convert dates prior to 1970");
  9141.     
  9142.     
  9143.     SEE ALSO: ymd_to_julian(), julian_to_ymd(), julian_to_wkday(),
  9144.               julian_to_yrday(), julian_to_dayname(), julian_to_tm(),
  9145.               time_to_julian(), tm_to_julian
  9146.  
  9147.  
  9148.  
  9149.  
  9150.  
  9151.  
  9152.  
  9153.  
  9154.  
  9155.  
  9156.  
  9157.  
  9158.  
  9159.  
  9160.  
  9161.  
  9162.  
  9163.  
  9164.  
  9165.  
  9166.  
  9167.  
  9168.  
  9169.  
  9170.  
  9171.  
  9172.  
  9173.  
  9174.  
  9175. JUL2TM.FNC - Thu 23 Nov 89 00:20 - Page 140:  
  9176.  
  9177.     NAME
  9178.     
  9179.             julian_to_tm -- convert Julian date to tm structure
  9180.     
  9181.     
  9182.     PROTOTYPED IN:  mfltime.h
  9183.     
  9184.     
  9185.     SYNOPSIS
  9186.     
  9187.             r = julian_to_tm(julian,t);
  9188.             LOGICAL r;      SUCCESS or ERROR if year < 1970
  9189.             long julian;    Julian (scalar) date
  9190.             struct tm *t;   date/time data to convert
  9191.     
  9192.     
  9193.     DESCRIPTION
  9194.     
  9195.     This function converts scalar (Julian) dates to standard date and
  9196.     time values in a tm structure. Since Julian dates do not contain time
  9197.     information, the time is reset to midnight.
  9198.     
  9199.     
  9200.     
  9201.     EXAMPLE
  9202.     
  9203.             long jday;
  9204.             struct tm time;
  9205.     
  9206.             if (ERROR == julian_to_time(jday, &time))
  9207.                     puts("Can't convert dates prior to 1970");
  9208.     
  9209.     
  9210.     SEE ALSO: ymd_to_julian(), julian_to_ymd(), julian_to_wkday(),
  9211.               julian_to_yrday(), julian_to_dayname(), julian_to_time(),
  9212.               time_to_julian(), tm_to_julian
  9213.  
  9214.  
  9215.  
  9216.  
  9217.  
  9218.  
  9219.  
  9220.  
  9221.  
  9222.  
  9223.  
  9224.  
  9225.  
  9226.  
  9227.  
  9228.  
  9229.  
  9230.  
  9231.  
  9232.  
  9233.  
  9234.  
  9235.  
  9236.  
  9237.  
  9238.  
  9239.  
  9240.  
  9241. JUL2WDAY.FNC - Thu 23 Nov 89 00:20 - Page 141:  
  9242.  
  9243.     NAME
  9244.     
  9245.             julian_to_wkday -- convert Julian date to day of the week
  9246.     
  9247.     
  9248.     PROTOTYPED IN:  mfltime.h
  9249.     
  9250.     
  9251.     SYNOPSIS
  9252.     
  9253.             r = julian_to_wkday(julian);
  9254.             int r;          day of week (0=Sunday, 1-Monday, etc.)
  9255.             long julian;    Julian (scalar) date
  9256.     
  9257.     
  9258.     DESCRIPTION
  9259.     
  9260.     This function converts scalar (Julian) dates to a day of the week in
  9261.     the range of 0-6 with 0 being Sunday.
  9262.     
  9263.     
  9264.     EXAMPLE
  9265.     
  9266.             long jday;
  9267.             int i;
  9268.             char day[7] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
  9269.     
  9270.             i = julian_to_wkday(jday);
  9271.             printf("Julian date %ld was on a %s\n", jday, day[i]);
  9272.     
  9273.     
  9274.     SEE ALSO: ymd_to_julian(), julian_to_ymd(), julian_to_yrday(),
  9275.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  9276.               time_to_julian(), tm_to_julian
  9277.  
  9278.  
  9279.  
  9280.  
  9281.  
  9282.  
  9283.  
  9284.  
  9285.  
  9286.  
  9287.  
  9288.  
  9289.  
  9290.  
  9291.  
  9292.  
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.  
  9300.  
  9301.  
  9302.  
  9303.  
  9304.  
  9305.  
  9306.  
  9307. JUL2YDAY.FNC - Thu 23 Nov 89 00:20 - Page 142:  
  9308.  
  9309.     NAME
  9310.     
  9311.             julian_to_yrday -- convert Julian date to day of the year
  9312.     
  9313.     
  9314.     PROTOTYPED IN:  mfltime.h
  9315.     
  9316.     
  9317.     SYNOPSIS
  9318.     
  9319.             r = julian_to_yrday(julian);
  9320.             unsigned r;     day of the year (1 - 366)
  9321.             long julian;    Julian (scalar) date
  9322.     
  9323.     
  9324.     DESCRIPTION
  9325.     
  9326.     This routine gives the day number (1-366) of a given scalar (Julian)
  9327.     date.
  9328.     
  9329.     
  9330.     EXAMPLE
  9331.     
  9332.             long jday;
  9333.     
  9334.             printf("Julian date %ld was the %drd day of the year\n",
  9335.                     jday, julian_to_yrday(jday));
  9336.     
  9337.     
  9338.     SEE ALSO: ymd_to_julian(), julian_to_ymd(), julian_to_wkday(),
  9339.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  9340.               time_to_julian(), tm_to_julian
  9341.  
  9342.  
  9343.  
  9344.  
  9345.  
  9346.  
  9347.  
  9348.  
  9349.  
  9350.  
  9351.  
  9352.  
  9353.  
  9354.  
  9355.  
  9356.  
  9357.  
  9358.  
  9359.  
  9360.  
  9361.  
  9362.  
  9363.  
  9364.  
  9365.  
  9366.  
  9367.  
  9368.  
  9369.  
  9370.  
  9371.  
  9372.  
  9373. JUL2YMD.FNC - Thu 23 Nov 89 00:20 - Page 143:  
  9374.  
  9375.     NAME
  9376.     
  9377.             julian_to_ymd -- convert Julian date to year, month, date
  9378.     
  9379.     
  9380.     PROTOTYPED IN:  mfltime.h
  9381.     
  9382.     
  9383.     SYNOPSIS
  9384.     
  9385.             julian_to_ymd(julian,yr,mo,day);
  9386.             long julian;    Julian (scalar) date
  9387.             unsigned *yr;   year
  9388.             unsigned *mo;   month
  9389.             unsigned *day;  date
  9390.     
  9391.     
  9392.     DESCRIPTION
  9393.     
  9394.     This function converts scalar (Julian) dates into calendar dates.
  9395.     
  9396.     
  9397.     EXAMPLE
  9398.     
  9399.             unsigned mo,day,yr;
  9400.             long jday;
  9401.     
  9402.             julian_to_ymd(jday, &yr, &mo, &day);
  9403.             printf("The calendar date is %d/%d/%d\n", mo, day, yr);
  9404.     
  9405.     
  9406.     SEE ALSO: ymd_to_julian(), julian_to_wkday(), julian_to_yrday(),
  9407.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  9408.               time_to_julian(), tm_to_julian
  9409.  
  9410.  
  9411.  
  9412.  
  9413.  
  9414.  
  9415.  
  9416.  
  9417.  
  9418.  
  9419.  
  9420.  
  9421.  
  9422.  
  9423.  
  9424.  
  9425.  
  9426.  
  9427.  
  9428.  
  9429.  
  9430.  
  9431.  
  9432.  
  9433.  
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439. KB_FLUSH.FNC - Thu 23 Nov 89 00:20 - Page 144:  
  9440.  
  9441.     NAME
  9442.     
  9443.             KB_flush -- empties keyboard buffer
  9444.     
  9445.     
  9446.     DEFINED IN:  mfldefs.h
  9447.     
  9448.     
  9449.     SYNOPSIS
  9450.     
  9451.             KB_flush();
  9452.     
  9453.     
  9454.     DESCRIPTION
  9455.     
  9456.     This is one of the macros included in MFLDEFS.H.  It flushes the
  9457.     keyboard buffer.
  9458.     
  9459.     
  9460.     EXAMPLES
  9461.         
  9462.             KB_flush();
  9463.  
  9464.  
  9465.  
  9466.  
  9467.  
  9468.  
  9469.  
  9470.  
  9471.  
  9472.  
  9473.  
  9474.  
  9475.  
  9476.  
  9477.  
  9478.  
  9479.  
  9480.  
  9481.  
  9482.  
  9483.  
  9484.  
  9485.  
  9486.  
  9487.  
  9488.  
  9489.  
  9490.  
  9491.  
  9492.  
  9493.  
  9494.  
  9495.  
  9496.  
  9497.  
  9498.  
  9499.  
  9500.  
  9501.  
  9502.  
  9503.  
  9504.  
  9505. KBSTATE.FNC - Thu 23 Nov 89 00:20 - Page 145:  
  9506.  
  9507.     NAME
  9508.     
  9509.             _kbstate -- returns keyboard status
  9510.     
  9511.     
  9512.     PROTOTYPED IN:  mflconio.h
  9513.     
  9514.     
  9515.     SYNOPSIS
  9516.     
  9517.              r = _kbstate();
  9518.              int r;    response
  9519.     
  9520.     
  9521.     DESCRIPTION
  9522.     
  9523.     This function _kbstate() returns the keyboard status flags in a strict
  9524.     binary format as they appear in memory, with :417 in the low byte and
  9525.     :418 in the high byte.
  9526.     
  9527.     
  9528.     EXAMPLE
  9529.              int r;
  9530.              r = _kbstate();
  9531.     
  9532.     
  9533.     SEE ALSO: kbstatus(), setcaps(), clrcaps(), setnumlock(), clrnumlock()
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542.  
  9543.  
  9544.  
  9545.  
  9546.  
  9547.  
  9548.  
  9549.  
  9550.  
  9551.  
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557.  
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.  
  9570.  
  9571. KBSTATUS.FNC - Thu 23 Nov 89 00:20 - Page 146:  
  9572.  
  9573.     NAME
  9574.     
  9575.             kbstatus -- returns specified keyboard status flag
  9576.     
  9577.     
  9578.     PROTOTYPED IN:  mflconio.h
  9579.     
  9580.     
  9581.     SYNOPSIS
  9582.     
  9583.              r = kbstatus(i);
  9584.              int r;    response
  9585.              int i;    which key status to return
  9586.     
  9587.     
  9588.     DESCRIPTION
  9589.     
  9590.     kbstatus(i) takes a value (fro the list below) and returns
  9591.     a TRUE or FALSE condition for the selected key state.
  9592.     
  9593.     For kbstatus the arguments are:
  9594.          0 = return status of shift key(s)
  9595.          1 = return insert state
  9596.          2 = return caps lock state
  9597.          3 = return num lock state
  9598.          4 = return scroll lock state
  9599.          5 = return <alt> state
  9600.          6 = return <ctrl> state
  9601.     
  9602.     
  9603.     EXAMPLE
  9604.     
  9605.                 setcaps();
  9606.                 if(kbstatus(2)) puts("Caps lock is now set");
  9607.                 else puts("Caps lock is NOT set");
  9608.                 clrcaps();
  9609.                 puts("Caps lock should now be off");
  9610.     
  9611.     
  9612.     SEE ALSO: _kbstate(), setcaps(), clrcaps(), setnumlock(), clrnumlock()
  9613.  
  9614.  
  9615.  
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.  
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.  
  9629.  
  9630.  
  9631.  
  9632.  
  9633.  
  9634.  
  9635.  
  9636.  
  9637. LASTCHAR.FNC - Thu 23 Nov 89 00:20 - Page 147:  
  9638.  
  9639.     NAME
  9640.     
  9641.             LAST_CHAR -- returns last string character
  9642.     
  9643.     
  9644.     DEFINED IN:  mflstrng.h
  9645.     
  9646.     
  9647.     SYNOPSIS
  9648.     
  9649.             r = LAST_CHAR(string);
  9650.             char r;         last character in string
  9651.             char *string;   string to process
  9652.     
  9653.     
  9654.     DESCRIPTION
  9655.     
  9656.     This is one of the macros included in MFLSTRNG.H.  LAST_CHAR returns the
  9657.     last character of a string.
  9658.     
  9659.     
  9660.     EXAMPLES
  9661.         
  9662.             char *path;
  9663.             /* strip dangling backslash if not the root                 */
  9664.             if ('\\' == LAST_CHAR(path) && ':' != NEXT_TO_LAST_CHAR(path))
  9665.             LAST_CHAR(path) = '\0';
  9666.     
  9667.     
  9668.     SEE ALSO: NEXT_TO_LAST_CHAR(), STRING_TERMINATOR()
  9669.     
  9670.  
  9671.  
  9672.  
  9673.  
  9674.  
  9675.  
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.  
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.  
  9688.  
  9689.  
  9690.  
  9691.  
  9692.  
  9693.  
  9694.  
  9695.  
  9696.  
  9697.  
  9698.  
  9699.  
  9700.  
  9701.  
  9702.  
  9703. LCASFILT.FNC - Thu 23 Nov 89 00:20 - Page 148:  
  9704.  
  9705.     NAME
  9706.     
  9707.             lcase_filt -- a filter to force streams to lower case
  9708.     
  9709.     
  9710.     PROTOTYPED IN:  mflfiles.h
  9711.     
  9712.     
  9713.     SYNOPSIS
  9714.     
  9715.             r = sfinstall(stream,lcase_filt);
  9716.             int r;          SUCCESS or ERROR
  9717.             SFILE *stream;  stream to be filtered
  9718.     
  9719.     
  9720.     DESCRIPTION
  9721.     
  9722.     Not a function, lcase_filt is an SFILTER structure used with sfinstall()
  9723.     to force streams to lower case.
  9724.     
  9725.     
  9726.     EXAMPLE
  9727.     
  9728.             SFILE *infile;
  9729.     
  9730.             infile = sfopen("file.ext", "r");   /* input from a file      */
  9731.             crypt_install(infile, "keytxt", 0); /* encrypt using "keytxt" */
  9732.             sfinstall(infile, lcase_filt);      /* after converting to LC */
  9733.     
  9734.     
  9735.     SEE ALSO: sfopen(), scopen(), sclose(), sfinstall(), crypt_install(),
  9736.               ucase_filt
  9737.  
  9738.  
  9739.  
  9740.  
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.  
  9747.  
  9748.  
  9749.  
  9750.  
  9751.  
  9752.  
  9753.  
  9754.  
  9755.  
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  
  9763.  
  9764.  
  9765.  
  9766.  
  9767.  
  9768.  
  9769. LEFT.FNC - Thu 23 Nov 89 00:20 - Page 149:  
  9770.  
  9771.     NAME
  9772.     
  9773.             left -- return leftmost characters
  9774.     
  9775.     
  9776.     PROTOTYPED IN:  mflstrng.h
  9777.     
  9778.     
  9779.     SYNOPSIS
  9780.     
  9781.             s = left(string,n);
  9782.             char *s;        target string
  9783.             char *string;   source string
  9784.             int n;          number of characters
  9785.     
  9786.     
  9787.     DESCRIPTION
  9788.     
  9789.     This is an emulation of the BASIC "LEFT$" function. It returns a
  9790.     left-justified substring of the specified string. This function uses
  9791.     the stralloc() funtion to allocate memory for the returned string.
  9792.     This memory is maintained in a circular pool and reused. See
  9793.     stralloc() for further information. Use strdup() or strcpy() to save
  9794.     the returned string in more permanent storage.
  9795.     
  9796.     
  9797.     EXAMPLE
  9798.     
  9799.             char *a = "European";
  9800.             a = left(a,2);
  9801.             puts(a);
  9802.             /* prints "Eu"       */
  9803.     
  9804.     
  9805.     SEE ALSO: right(), mid(), string_add(), str_init()), stralloc(),
  9806.               str_free()
  9807.  
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.  
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.  
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.  
  9833.  
  9834.  
  9835. LOADSTR.FNC - Thu 23 Nov 89 00:20 - Page 150:  
  9836.  
  9837.     NAME
  9838.     
  9839.             loadstr -- load a string with padding
  9840.     
  9841.     
  9842.     PROTOTYPED IN:  mflstrng.h
  9843.     
  9844.     
  9845.     SYNOPSIS
  9846.     
  9847.             void loadstr(dest, source, qty);
  9848.             char *dest;       string destination
  9849.             char *source;     source string (NULL terminated)
  9850.             int qty;          bytes to place in destination
  9851.     
  9852.     
  9853.     DESCRIPTION
  9854.     
  9855.     This function is similar to strcat() in that it copies a source string
  9856.     to a destination string.  However, if the source string is smaller
  9857.     than "qty", the destination will be padded to the "qty" parameter with
  9858.     spaces.  In addition, the destination string will NOT be terminated by
  9859.     a NULL.  This is an unusual method of operation, but handy in some
  9860.     cases.
  9861.     
  9862.     
  9863.     EXAMPLE
  9864.     
  9865.        char title[] = "This is a title";
  9866.        char buffer[128];
  9867.     
  9868.        loadstr(buffer, title, 80);
  9869.        buffer[80] = NULL;         /* add terminator */
  9870.        puts(buffer);       /* message will be 80 characters long,
  9871.                            ** left justified */
  9872.  
  9873.  
  9874.  
  9875.  
  9876.  
  9877.  
  9878.  
  9879.  
  9880.  
  9881.  
  9882.  
  9883.  
  9884.  
  9885.  
  9886.  
  9887.  
  9888.  
  9889.  
  9890.  
  9891.  
  9892.  
  9893.  
  9894.  
  9895.  
  9896.  
  9897.  
  9898.  
  9899.  
  9900.  
  9901. LOC_CONV.FNC - Thu 23 Nov 89 00:20 - Page 151:  
  9902.  
  9903.     NAME
  9904.     
  9905.             localeconv -- get master locale information
  9906.     
  9907.     
  9908.     PROTOTYPED IN:  locale.h
  9909.     
  9910.     
  9911.     PORTABILITY: ANSI
  9912.     
  9913.     
  9914.     SYNOPSIS
  9915.     
  9916.              r = localeconv();
  9917.              struct lconv *r; pointer to master locale
  9918.     
  9919.     
  9920.     DESCRIPTION
  9921.     
  9922.     This function returns a pointer to the master locale.  See setlocale()
  9923.     for details.
  9924.     
  9925.     
  9926.     EXAMPLE
  9927.     
  9928.            struct lconv my_locale;
  9929.            setlocale(LC_ALL, NULL);         /* returns "C"                */
  9930.            my_locale = localeconv();        /* copy defaults              */
  9931.            my_locale.TZ_txt = {"PST","PDT"};/* set Pacific Daylight Time  */
  9932.            my_locale.TZ_hrs=8;
  9933.            my_locale.DST_flag = 1;
  9934.            my_locale.s_time = "CA dreaming";
  9935.            setlocale(LC_TIME, NULL);        /* returns "CA dreaming"      */
  9936.            setlocale(LC_ALL, "C");          /* returns "C", resets master */
  9937.     
  9938.     
  9939.     SEE ALSO: setlocale()
  9940.  
  9941.  
  9942.  
  9943.  
  9944.  
  9945.  
  9946.  
  9947.  
  9948.  
  9949.  
  9950.  
  9951.  
  9952.  
  9953.  
  9954.  
  9955.  
  9956.  
  9957.  
  9958.  
  9959.  
  9960.  
  9961.  
  9962.  
  9963.  
  9964.  
  9965.  
  9966.  
  9967. LSQRT.FNC - Thu 23 Nov 89 00:20 - Page 152:  
  9968.  
  9969.     NAME
  9970.     
  9971.             lsqrt  -- extract integer square root of a long
  9972.     
  9973.     
  9974.     PROTOTYPED IN:  mflmath.h
  9975.     
  9976.     
  9977.     SYNOPSIS
  9978.     
  9979.              result = lsqrt(number);
  9980.              long result;          square root (truncated)
  9981.              unsigned long number; number whose square root to extract
  9982.     
  9983.     
  9984.     DESCRIPTION
  9985.     
  9986.     This function is part of a set of routines provided primarily for
  9987.     embedded systems programmers. These routines extract the square root
  9988.     of either a short or long integer number without the use of floating
  9989.     point math.
  9990.     
  9991.     
  9992.     EXAMPLE
  9993.     
  9994.             int i;
  9995.             for (i = 4; i < 9; ++i)
  9996.                 printf("sqrt(%d) = %d\n",
  9997.                     i, isqrt(i));
  9998.     
  9999.                     /* prints:      sqrt(4) = 2
  10000.                                     sqrt(5) = 2
  10001.                                     sqrt(6) = 2
  10002.                                     sqrt(7) = 2
  10003.                                     sqrt(8) = 2
  10004.                                     sqrt(9) = 3                  */
  10005.     
  10006.     
  10007.     SEE ALSO:  isqrt(), isqrtr(), lsqrtr()
  10008.  
  10009.  
  10010.  
  10011.  
  10012.  
  10013.  
  10014.  
  10015.  
  10016.  
  10017.  
  10018.  
  10019.  
  10020.  
  10021.  
  10022.  
  10023.  
  10024.  
  10025.  
  10026.  
  10027.  
  10028.  
  10029.  
  10030.  
  10031.  
  10032.  
  10033. LSQRTR.FNC - Thu 23 Nov 89 00:20 - Page 153:  
  10034.  
  10035.     NAME
  10036.     
  10037.             lsqrtr -- extract integer square root of a long w/ rounding
  10038.     
  10039.     
  10040.     PROTOTYPED IN:  mflmath.h
  10041.     
  10042.     
  10043.     SYNOPSIS
  10044.     
  10045.             result = lsqrtr(number);
  10046.             long result;          square root (rounded)
  10047.             unsigned long number; number whose square root to extract
  10048.     
  10049.     
  10050.     DESCRIPTION
  10051.     
  10052.     This function is part of a set of routines provided primarily for
  10053.     embedded systems programmers using. lsqrtr() extracts the integer
  10054.     square root of a long w/ rounding.
  10055.     
  10056.     
  10057.     EXAMPLE
  10058.     
  10059.                     int i;
  10060.                     for (i = 4; i < 9; ++i)
  10061.                             printf("sqrt(%d) =  %d\n",
  10062.                                     i, isqrtr(i));
  10063.     
  10064.                     /* prints:      sqrt(4) = 2
  10065.                                     sqrt(5) = 2
  10066.                                     sqrt(6) = 2
  10067.                                     sqrt(7) = 3
  10068.                                     sqrt(8) = 3
  10069.                                     sqrt(9) = 3                  */
  10070.     
  10071.     
  10072.     SEE ALSO: isqrt(), isqrtr(), lsqrt()
  10073.  
  10074.  
  10075.  
  10076.  
  10077.  
  10078.  
  10079.  
  10080.  
  10081.  
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.  
  10098.  
  10099. LV1WS.FNC - Thu 23 Nov 89 00:20 - Page 154:  
  10100.  
  10101.     NAME
  10102.     
  10103.             lv1ws -- remove excess whitespace from string
  10104.     
  10105.     
  10106.     PROTOTYPED IN:  mflstrng.h
  10107.     
  10108.     
  10109.     SYNOPSIS
  10110.     
  10111.             void lv1ws(str);
  10112.             char *str;     string to modify
  10113.     
  10114.     
  10115.     DESCRIPTION
  10116.     
  10117.     This function modifies the specified string in place. White
  10118.     space is defined as the space character, tab character, vertical
  10119.     tab, linefeed, carriage return, and formfeed. Each white space
  10120.     character is replaced with a space. Multiple white space
  10121.     characters are replaced by a single space.
  10122.     
  10123.     
  10124.     EXAMPLE
  10125.     
  10126.         char string[] = "   This is  a \x8\x0c  string   \n";
  10127.     
  10128.         lv1ws(string);  /* returns " This is a string \n" */
  10129.     
  10130.     
  10131.     SEE ALSO: rmlead(), rmtrail(), rmallws()
  10132.  
  10133.  
  10134.  
  10135.  
  10136.  
  10137.  
  10138.  
  10139.  
  10140.  
  10141.  
  10142.  
  10143.  
  10144.  
  10145.  
  10146.  
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.  
  10160.  
  10161.  
  10162.  
  10163.  
  10164.  
  10165. MID.FNC - Thu 23 Nov 89 00:20 - Page 155:  
  10166.  
  10167.     NAME
  10168.     
  10169.             mid -- return embedded substring
  10170.     
  10171.     
  10172.     PROTOTYPED IN:  mflstrng.h
  10173.     
  10174.     
  10175.     SYNOPSIS
  10176.     
  10177.             s = mid(string,n,m);
  10178.             char *s;        target string
  10179.             char *string;   source string
  10180.             int n;          first character
  10181.             int m;          number of characters
  10182.     
  10183.     
  10184.     DESCRIPTION
  10185.     
  10186.     This is an emulation of the BASIC "MID$" function. It returns a
  10187.     specified-length substring of the specified string. This function
  10188.     uses the stralloc() funtion to allocate memory for the returned
  10189.     string.  This memory is maintained in a circular pool and reused. See
  10190.     stralloc() for further information. Use strdup() or strcpy() to save
  10191.     the returned string in more permanent storage.
  10192.     
  10193.     
  10194.     EXAMPLE
  10195.     
  10196.             char *a;
  10197.             char *c = "Skaters";
  10198.             a = mid(c,2,2);
  10199.             puts(a);
  10200.             /* prints "ka"       */
  10201.     
  10202.     
  10203.     SEE ALSO: left(), right(), string_add(), str_init(), stralloc(),
  10204.               str_free()
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.  
  10229.  
  10230.  
  10231. MKBOX.FNC - Thu 23 Nov 89 00:20 - Page 156:  
  10232.  
  10233.     NAME
  10234.     
  10235.             mkbox -- make a box on the screen
  10236.     
  10237.     
  10238.     PROTOTYPED IN:  mflconio.h
  10239.     
  10240.     
  10241.     SYNOPSIS
  10242.     
  10243.             #include <mflconio.h>
  10244.             void mkbox(startr, startc, width, ht, page);
  10245.             int startr;       starting row (top)
  10246.             int startc;       starting column (left)
  10247.             int width;        how many columns wide
  10248.             int ht;           how many rows high
  10249.             int page;         which video page (assuming
  10250.                               proper video mode)
  10251.     
  10252.     
  10253.     DESCRIPTION
  10254.     
  10255.     This function will make a double line box using the IBM graphics
  10256.     characters on the "page" specified.  The "startr" and "startc"
  10257.     parameters anchor the upper left corner.  The "ht" and "width" set the
  10258.     dimensions.  No checks are made for valid numbers.  Function can be
  10259.     used with both CGA and Mono cards, and with EGA cards in CGA or MONO
  10260.     modes.
  10261.     
  10262.     
  10263.     EXAMPLE
  10264.     
  10265.            mkbox(0, 0, 80, 23, 0);
  10266.        /* will make a box around the outside of an 80 x 24 screen. */
  10267.     
  10268.     
  10269.     SEE ALSO: disp_box()
  10270.  
  10271.  
  10272.  
  10273.  
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279.  
  10280.  
  10281.  
  10282.  
  10283.  
  10284.  
  10285.  
  10286.  
  10287.  
  10288.  
  10289.  
  10290.  
  10291.  
  10292.  
  10293.  
  10294.  
  10295.  
  10296.  
  10297. MKTONE.FNC - Thu 23 Nov 89 00:20 - Page 157:  
  10298.  
  10299.     NAME
  10300.     
  10301.             mktone -- make a tone to the speaker
  10302.     
  10303.     
  10304.     PROTOTYPED IN:  mflsound.h
  10305.     
  10306.     
  10307.     SYNOPSIS
  10308.     
  10309.             #include "sound.h"
  10310.             void mktone(freq, update, delay);
  10311.             int freq;       frequency of tone
  10312.             int update      speaker control command
  10313.             int delay       value to delay before returning
  10314.     
  10315.     
  10316.     DESCRIPTION
  10317.     
  10318.     This is a very simple function to make a tone on the IBM speaker
  10319.     using the standard timer controller.  The frequency is an integer
  10320.     which increases the pitch of the tone with decreasing values.
  10321.     the delay is an integer which is used in a very simple "for" loop
  10322.     to control duration of the tone.  A value of 0 is no delay.
  10323.     The update integer is defined in sound.h as follows:
  10324.     
  10325.            if update == UPDATE  just send frequency and delay
  10326.            if update == TOGGLE  turn sound off after delay is complete
  10327.            else  turn sound on and leave it on when returning
  10328.     
  10329.     Any tone may be turned off by setting freq to 0.  In this case,
  10330.     update and delay values are ignored and may be set to any value.
  10331.     
  10332.     
  10333.     EXAMPLE
  10334.     
  10335.           #include <mflsound.h>
  10336.           mktone(1000, TOGGLE, 1000);  /* make a short beep */
  10337.     
  10338.           mktone(1000, ON, 0);         /* turn a tone on */
  10339.           mktone(0, 0, 0);             /* turn a tone off */
  10340.     
  10341.           mktone(2000, ON, 0);         /* turn a tone on */
  10342.           mktone(1000, UPDATE, 0);     /* raise the pitch */
  10343.           mktone(0, 0, 0);             /* turn it off */
  10344.     
  10345.     
  10346.     SEE ALSO: soundon(), soundoff()
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363. MONTHIS.FNC - Thu 23 Nov 89 00:20 - Page 158:  
  10364.  
  10365.     NAME
  10366.     
  10367.             monthis -- return a string pointer to name of month
  10368.     
  10369.     
  10370.     PROTOTYPED IN:  mfltime.h
  10371.     
  10372.     
  10373.     SYNOPSIS
  10374.     
  10375.             char *monthis(month);
  10376.             int month;      number of month 0-11
  10377.             
  10378.     
  10379.     DESCRIPTION
  10380.     
  10381.     This function returns a pointer to a character string naming
  10382.     the specified month.  The string is null terminated and may be
  10383.     used directly or copied to another string.  Month 0 is January.
  10384.     
  10385.     
  10386.     EXAMPLE
  10387.     
  10388.             printf("This is %s", monthis(7));
  10389.              /* printout will be:
  10390.                 This is August
  10391.              */
  10392.  
  10393.  
  10394.  
  10395.  
  10396.  
  10397.  
  10398.  
  10399.  
  10400.  
  10401.  
  10402.  
  10403.  
  10404.  
  10405.  
  10406.  
  10407.  
  10408.  
  10409.  
  10410.  
  10411.  
  10412.  
  10413.  
  10414.  
  10415.  
  10416.  
  10417.  
  10418.  
  10419.  
  10420.  
  10421.  
  10422.  
  10423.  
  10424.  
  10425.  
  10426.  
  10427.  
  10428.  
  10429. MSECPAWS.FNC - Thu 23 Nov 89 00:20 - Page 159:  
  10430.  
  10431.     NAME
  10432.     
  10433.             msec_pause     -- pause a given number of milliseconds
  10434.     
  10435.     
  10436.     PROTOTYPED IN:  mfltime.h
  10437.     
  10438.     
  10439.     SYNOPSIS
  10440.     
  10441.             msec_pause(msec)
  10442.             long msec;      number of milliseconds to pause
  10443.     
  10444.     
  10445.     DESCRIPTION
  10446.     
  10447.     This function is part of a group of high-precision timing functions
  10448.     with an accuracy of one microsecond on IBM and closely compatible
  10449.     computers. To function properly, these functions require the host
  10450.     system to use either an 8253 or 8254 counter/timer chip based at I/O
  10451.     address 40h to generate the 18.2 Hz system interrupt used by DOS.
  10452.     These functions further assume that DOS uses the four bytes at 40:6C
  10453.     for its timekeeping function. These have proven to be safe assumptions
  10454.     for all IBM PC's and PS/2's, Compaq's, as well as most other clone
  10455.     computers and single-board computers designed for MS/PC-DOS
  10456.     compatibility. The sole exception is msec_pause() which requires the
  10457.     counter/timer chip but makes no other assumptions.
  10458.     
  10459.     msec_pause() is a delay function which delays a specified number of
  10460.     milliseconds.
  10461.     
  10462.     
  10463.     EXAMPLE
  10464.     
  10465.             long r;
  10466.             msec_pause(r);
  10467.     
  10468.     
  10469.     SEE ALSO: usec_clock(), restart_uclock(), usec_delay(), usec_difftime(),
  10470.               usec_timeout(), msec_pause()
  10471.  
  10472.  
  10473.  
  10474.  
  10475.  
  10476.  
  10477.  
  10478.  
  10479.  
  10480.  
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.  
  10494.  
  10495. NEWEXT.FNC - Thu 23 Nov 89 00:20 - Page 160:  
  10496.  
  10497.     NAME
  10498.     
  10499.             newext -- change a filename extension
  10500.     
  10501.     
  10502.     PROTOTYPED IN:  mflfiles.h
  10503.     
  10504.     
  10505.     SYNOPSIS
  10506.     
  10507.             void newext(old, new, extn);
  10508.             char *old       original filename string
  10509.             char *new       destination for new filename
  10510.             char *extn      new extension string
  10511.     
  10512.     
  10513.     DESCRIPTION
  10514.     
  10515.     This function will make a new filename from an existing
  10516.     filename and a specified extension string.  The original
  10517.     filename string is left unchanged, since its base is copied to a
  10518.     new string area.  Nothing is returned.
  10519.     
  10520.     EXAMPLE
  10521.     
  10522.          char old[] = "FOOBAR.COM";
  10523.          char new[14];
  10524.     
  10525.          newext(old, new, "BIN");
  10526.     
  10527.     
  10528.     After operation, the filename string in "new" will be:
  10529.          FOOBAR.BIN
  10530.     
  10531.     Character strings are NULL terminated.  The original string
  10532.     need not have any extension or period terminator, and may
  10533.     contain a path specifier.  Note that the destination string
  10534.     area must be long enough to hold the new filename.
  10535.     
  10536.     
  10537.     SEE ALSO: exttyp(), badext()
  10538.  
  10539.  
  10540.  
  10541.  
  10542.  
  10543.  
  10544.  
  10545.  
  10546.  
  10547.  
  10548.  
  10549.  
  10550.  
  10551.  
  10552.  
  10553.  
  10554.  
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.  
  10561. NXT2LAST.FNC - Thu 23 Nov 89 00:20 - Page 161:  
  10562.  
  10563.     NAME
  10564.     
  10565.             NEXT_TO_LAST_CHAR -- returns penultimate string character
  10566.     
  10567.     
  10568.     DEFINED IN:  mflstrng.h
  10569.     
  10570.     
  10571.     SYNOPSIS
  10572.     
  10573.             r = NEXT_TO_LAST_CHAR(string);
  10574.             char r;         penultimate character in string
  10575.             char *string;   string to process
  10576.     
  10577.     
  10578.     DESCRIPTION
  10579.     
  10580.     This is one of the macros included in MFLSTRNG.H.  It returns the next
  10581.     to last character (the last character before the NULL) in a character
  10582.     string.
  10583.     
  10584.     
  10585.     EXAMPLES
  10586.         
  10587.                 char *path;
  10588.                 /* strip dangling backslash if not the root                 */
  10589.                 if ('\\' == LAST_CHAR(path) && ':' != NEXT_TO_LAST_CHAR(path))
  10590.                    LAST_CHAR(path) = '\0';
  10591.     
  10592.     
  10593.     SEE ALSO: LAST_CHAR(), STRING_TERMINATOR()
  10594.     
  10595.     
  10596.     
  10597.     
  10598.             This function is found in SMZTx.LIB for the Zortech Compiler
  10599.  
  10600.  
  10601.  
  10602.  
  10603.  
  10604.  
  10605.  
  10606.  
  10607.  
  10608.  
  10609.  
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.  
  10620.  
  10621.  
  10622.  
  10623.  
  10624.  
  10625.  
  10626.  
  10627. OFFSETOF.FNC - Thu 23 Nov 89 00:20 - Page 162:  
  10628.  
  10629.     NAME
  10630.     
  10631.             offsetof -- returns element's position in struct
  10632.     
  10633.     
  10634.     DEFINED IN:  mfldefs.h
  10635.     
  10636.     
  10637.     PORTABILITY: offsetof() is compatible with ANSI C and is implemented
  10638.                  as a macro per the draft ANSI specification.
  10639.                        
  10640.                        
  10641.     SYNOPSIS
  10642.     
  10643.             r = offsetof(st,el);
  10644.             int r;          offset within...
  10645.             struct st;      structure of...
  10646.             void el;        structure element
  10647.     
  10648.     
  10649.     DESCRIPTION
  10650.     
  10651.     The offsetof() macro is defined in the draft ANSI standard as
  10652.     returning the offset of an element within a structure.
  10653.     
  10654.     
  10655.     EXAMPLES
  10656.     
  10657.             struct xyz {
  10658.                     long abc;
  10659.                     int  def;
  10660.                     };
  10661.       
  10662.             printf("def is at position %d\n", offsetof(xyz,def));
  10663.             /* prints "4"       */
  10664.  
  10665.  
  10666.  
  10667.  
  10668.  
  10669.  
  10670.  
  10671.  
  10672.  
  10673.  
  10674.  
  10675.  
  10676.  
  10677.  
  10678.  
  10679.  
  10680.  
  10681.  
  10682.  
  10683.  
  10684.  
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.  
  10692.  
  10693. OPEND.FNC - Thu 23 Nov 89 00:20 - Page 163:  
  10694.  
  10695.     NAME
  10696.     
  10697.             openp -- open a file in the PATH
  10698.     
  10699.     
  10700.     PROTOTYPED IN:  mflfiles.h
  10701.     
  10702.     
  10703.     SYNOPSIS
  10704.     
  10705.             fh = opend(name, mode, envar);
  10706.     
  10707.                     int fh;            file handle returned
  10708.                     char *name;        filename
  10709.                     int mode;          mode
  10710.                     char *envar        name of environment variable
  10711.     
  10712.     
  10713.     DESCRIPTION
  10714.     
  10715.     This function allows the opening of a file in other than just the
  10716.     current directory.  It attempt the open in the current directory
  10717.     first, and if that fails, will then expand to search along the PATH
  10718.     environment variable. It will return -1 upon failure.  The file MUST
  10719.     EXIST in order for a file handle to be returned.  Therefore, this
  10720.     function cannot be used to create new files. See fopenp for the same
  10721.     function using file descriptor structures.
  10722.     
  10723.     
  10724.     EXAMPLE
  10725.     
  10726.             int fh;
  10727.     
  10728.             if((fh = opend("stdio.h", O_READ, "INCLUDE")) == -1)
  10729.                     cant("stdio.h");
  10730.             else    puts("stdio.h is open for reading");
  10731.     
  10732.     
  10733.     SEE ALSO: opend(), openg(), fopend(), fopenp(), fopeng()
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756.  
  10757.  
  10758.  
  10759. OPENDIR.FNC - Thu 23 Nov 89 00:20 - Page 164:  
  10760.  
  10761.     NAME
  10762.     
  10763.             opendir   -- open a directory for reading
  10764.     
  10765.     
  10766.     PROTOTYPED IN:  mflfiles.h
  10767.     
  10768.     
  10769.     SYNOPSIS
  10770.     
  10771.              r=opendir(s1);
  10772.              DOS_DIR *r;     directory file pointer.
  10773.                              r->dd_size - number of directory entries
  10774.                              r->dd_loc  - current entry number
  10775.              char *s1;       name of directory to open
  10776.     
  10777.     
  10778.     DESCRIPTION
  10779.     
  10780.     This function is similar to one found on Unix 4.2 BSD
  10781.     systems. IT is designed to make reading DOS directories almost
  10782.     as simple as reading normal files.
  10783.     
  10784.     The opendir() function is an analog of fopen(). It returns a
  10785.     special type of file pointer upon success or a NULL in case of
  10786.     error. Possible errors include trying to open a non-directory or
  10787.     exceeding the maximum number of permissible open files. Like DOS
  10788.     files, there is a limit to how many directories may be open at one
  10789.     time. Under the small and medium models, only 16 directories may
  10790.     be opened at one time. Under the large and compact models, up to
  10791.     48 directories may be open simultaneously. When the directory is
  10792.     opened, the dd_size field in the DOS_DIR structure is filled in
  10793.     with the total number of files, including subdirectories and "dot"
  10794.     directories contained.
  10795.     
  10796.     The opendir() function sets the DFerr global
  10797.     variable depending on their return status. The error codes in
  10798.     ERROR.H are used along with EOF and SUCCESS.
  10799.     
  10800.     
  10801.     EXAMPLE
  10802.     
  10803.             char *name[] = "C:\looney\bin";
  10804.             DOS_DIR *dirp;
  10805.             struct FIND *ffblk;
  10806.     
  10807.             if(dirp=opendir(name))
  10808.             {
  10809.                 printf("%s contains %d entries\n", name, dirp->dd_size);
  10810.                 while (ffblk=readdir(dirp))
  10811.                 {
  10812.                     printf("%3d - %s\n", dirp->dd_loc, ffblk->name);
  10813.                 }
  10814.                 closedir(dirp);
  10815.             }
  10816.     
  10817.     
  10818.     SEE ALSO readdir(), closedir()
  10819.  
  10820.  
  10821.  
  10822.  
  10823.  
  10824.  
  10825. OPENG.FNC - Thu 23 Nov 89 00:20 - Page 165:  
  10826.  
  10827.     NAME
  10828.     
  10829.             openg -- opend/openp combination
  10830.     
  10831.     
  10832.     PROTOTYPED IN:  mflfiles.h
  10833.     
  10834.     
  10835.     SYNOPSIS
  10836.     
  10837.             int fh;            file handle returned
  10838.             char *name;        filename
  10839.             int mode;          mode
  10840.             char *envar;       name of environment variable
  10841.     
  10842.     
  10843.     DESCRIPTION
  10844.     
  10845.     This function allows the opening of a file in other than just the
  10846.     current directory.  It will attempt the open in the current directory
  10847.     first, and if that fails, will then expand to search along a path
  10848.     specified by an environment variable.  If this fails it will continue
  10849.     searching along the PATH variable This function will return -1 upon
  10850.     failure.  The file MUST EXIST in order for a file handle to be
  10851.     returned.  Therefore, fopeng() cannot be used to create new files. See
  10852.     fopeng for the same functions using file descriptor structures.
  10853.     
  10854.     
  10855.     EXAMPLE
  10856.     
  10857.             int fh;
  10858.     
  10859.             if((fh = openg("stdio.h", O_READ, "INCLUDE")) == -1)
  10860.                     cant("stdio.h");
  10861.             else    puts("stdio.h is open for reading");
  10862.     
  10863.     
  10864.     SEE ALSO: opend(), openg(), fopend(), fopenp(), fopeng()
  10865.  
  10866.  
  10867.  
  10868.  
  10869.  
  10870.  
  10871.  
  10872.  
  10873.  
  10874.  
  10875.  
  10876.  
  10877.  
  10878.  
  10879.  
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.  
  10886.  
  10887.  
  10888.  
  10889.  
  10890.  
  10891. OPENP.FNC - Thu 23 Nov 89 00:20 - Page 166:  
  10892.  
  10893.     NAME
  10894.     
  10895.             openp -- open a file in the PATH
  10896.     
  10897.     
  10898.     PROTOTYPED IN:  mflfiles.h
  10899.     
  10900.     
  10901.     SYNOPSIS
  10902.     
  10903.             fh = openp(name, mode);
  10904.             int fh;            file handle returned
  10905.             char *name;        filename
  10906.             int mode;          mode
  10907.     
  10908.     
  10909.     DESCRIPTION
  10910.     
  10911.     This function allows the opening of a file in other than just the
  10912.     current directory.  It will attempt the open in the current directory
  10913.     first, and if that fails, will then expand to search along a path
  10914.     specified by an environment variable. openp() will return -1 upon
  10915.     failure.  The file MUST EXIST in order for a file handle to be
  10916.     returned.  Therefore, this function cannot be used to create new
  10917.     files. See fopenp for the same functions using file descriptor
  10918.     structures.
  10919.     
  10920.     
  10921.     EXAMPLE
  10922.     
  10923.             int fh;
  10924.     
  10925.             if((fh = openp("foo.bar", O_READ)) == -1) cant("foo.bar");
  10926.             else puts("File is now opened!");
  10927.     
  10928.     SEE ALSO: opend(), openg(), fopend(), fopenp(), fopeng()
  10929.     
  10930.  
  10931.  
  10932.  
  10933.  
  10934.  
  10935.  
  10936.  
  10937.  
  10938.  
  10939.  
  10940.  
  10941.  
  10942.  
  10943.  
  10944.  
  10945.  
  10946.  
  10947.  
  10948.  
  10949.  
  10950.  
  10951.  
  10952.  
  10953.  
  10954.  
  10955.  
  10956.  
  10957. POPDIR.FNC - Thu 23 Nov 89 00:20 - Page 167:  
  10958.  
  10959.     NAME
  10960.     
  10961.             popdir  -- return to previous directory
  10962.     
  10963.     
  10964.     PROTOTYPED IN:  mflfiles.h
  10965.     
  10966.     
  10967.     SYNOPSIS
  10968.     
  10969.              r = popdir();
  10970.              int r;          returns: -1 if stack empty
  10971.                                        0 if error
  10972.                                        1 if success (same drive)
  10973.                                        2 if success (changed drives)
  10974.     
  10975.     
  10976.     DESCRIPTION
  10977.     
  10978.     This functions restores the last disk directory stored with pushdir.
  10979.     A static stack of eight directories is maintained
  10980.     for small and medium memory models, thirty-two for large and
  10981.     compact models.
  10982.     
  10983.     
  10984.     EXAMPLE
  10985.         
  10986.             if (0 < pushdir("c:utility"))
  10987.             {       /* do some stuff in C:UTILITY */
  10988.                     if (0 < popdir())
  10989.                             puts("We're back home!");
  10990.                     else    puts("oops...");
  10991.             }
  10992.             else    puts("Couldn't change to C:UTILITY");
  10993.     
  10994.     
  10995.     SEE ALSO: pushdir()
  10996.  
  10997.  
  10998.  
  10999.  
  11000.  
  11001.  
  11002.  
  11003.  
  11004.  
  11005.  
  11006.  
  11007.  
  11008.  
  11009.  
  11010.  
  11011.  
  11012.  
  11013.  
  11014.  
  11015.  
  11016.  
  11017.  
  11018.  
  11019.  
  11020.  
  11021.  
  11022.  
  11023. PR_CARRE.FNC - Thu 23 Nov 89 00:20 - Page 168:  
  11024.  
  11025.     NAME
  11026.     
  11027.             pr_carret -- send a carriage return to the printer
  11028.     
  11029.     
  11030.     PROTOTYPED IN:  mflsys.h
  11031.     
  11032.     
  11033.     SYNOPSIS
  11034.     
  11035.             void pr_carret();
  11036.     
  11037.     
  11038.     DESCRIPTION
  11039.     
  11040.     This is part of a series of routines use the low level functions
  11041.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers directly.
  11042.     pr_putc() returns the same status that is returned by blprstat().  Be
  11043.     sure to use pr_set() to set which LPT is to be accessed.  Note that
  11044.     the library defaults to LPT1:, and pr_set() may be ignored if that
  11045.     printer is to be used.
  11046.     
  11047.     
  11048.     EXAMPLE
  11049.     
  11050.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11051.                pr_carret();
  11052.     
  11053.     
  11054.     SEE ALSO: pr_nl(), pr_puts(), pr_line(), pr_eject(), pr_set(), pr_putc()
  11055.  
  11056.  
  11057.  
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.  
  11064.  
  11065.  
  11066.  
  11067.  
  11068.  
  11069.  
  11070.  
  11071.  
  11072.  
  11073.  
  11074.  
  11075.  
  11076.  
  11077.  
  11078.  
  11079.  
  11080.  
  11081.  
  11082.  
  11083.  
  11084.  
  11085.  
  11086.  
  11087.  
  11088.  
  11089. PR_EJECT.FNC - Thu 23 Nov 89 00:20 - Page 169:  
  11090.  
  11091.     NAME
  11092.     
  11093.             pr_eject -- send a formfeed to the printer
  11094.     
  11095.     
  11096.     PROTOTYPED IN:  mflsys.h
  11097.     
  11098.     
  11099.     SYNOPSIS
  11100.     
  11101.             void pr_eject();
  11102.     
  11103.     
  11104.     DESCRIPTION
  11105.     
  11106.     This is part of a series of routines use the low level functions
  11107.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers directly.
  11108.     pr_putc() returns the same status that is returned by blprstat().  Be
  11109.     sure to use pr_set() to set which LPT is to be accessed.  Note that
  11110.     the library defaults to LPT1:, and pr_set() may be ignored if that
  11111.     printer is to be used.
  11112.     
  11113.     
  11114.     EXAMPLE
  11115.     
  11116.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11117.                pr_putline("Hello World");
  11118.                pr_eject();
  11119.     
  11120.     
  11121.     SEE ALSO: pr_nl(), pr_puts(), pr_line(), pr_carret(), pr_set(), pr_putc()
  11122.  
  11123.  
  11124.  
  11125.  
  11126.  
  11127.  
  11128.  
  11129.  
  11130.  
  11131.  
  11132.  
  11133.  
  11134.  
  11135.  
  11136.  
  11137.  
  11138.  
  11139.  
  11140.  
  11141.  
  11142.  
  11143.  
  11144.  
  11145.  
  11146.  
  11147.  
  11148.  
  11149.  
  11150.  
  11151.  
  11152.  
  11153.  
  11154.  
  11155. PR_NL.FNC - Thu 23 Nov 89 00:20 - Page 170:  
  11156.  
  11157.     NAME
  11158.     
  11159.             pr_nl -- print a carriage return/line feed to printer
  11160.     
  11161.     
  11162.     PROTOTYPED IN:  mflsys.h
  11163.     
  11164.     
  11165.     SYNOPSIS
  11166.     
  11167.             void pr_nl();
  11168.     
  11169.     
  11170.     DESCRIPTION
  11171.     
  11172.     This is part of a series of routines use the low level functions
  11173.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers
  11174.     directly.  pr_putc() returns the same status that is returned
  11175.     by blprstat().  Be sure to use pr_set() to set which LPT is
  11176.     to be accessed.  Note that the library defaults to LPT1:,
  11177.     and pr_set() may be ignored if that printer is to be used.
  11178.     
  11179.     
  11180.     EXAMPLE
  11181.     
  11182.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11183.                pr_putline("Hello World");
  11184.                pr_eject();
  11185.     
  11186.     
  11187.     SEE ALSO: pr_puts(), pr_putline(), pr_eject(), pr_carret(), pr_set(),
  11188.               pr_putc()
  11189.  
  11190.  
  11191.  
  11192.  
  11193.  
  11194.  
  11195.  
  11196.  
  11197.  
  11198.  
  11199.  
  11200.  
  11201.  
  11202.  
  11203.  
  11204.  
  11205.  
  11206.  
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.  
  11215.  
  11216.  
  11217.  
  11218.  
  11219.  
  11220.  
  11221. PR_PUTC.FNC - Thu 23 Nov 89 00:20 - Page 171:  
  11222.  
  11223.     NAME
  11224.     
  11225.             pr_putc -- send a character to the printer
  11226.     
  11227.     
  11228.     PROTOTYPED IN:  mflsys.h
  11229.     
  11230.     
  11231.     SYNOPSIS
  11232.     
  11233.             r = pr_putc(ch);  char ch;  int r; (returned status)
  11234.     
  11235.     
  11236.     DESCRIPTION
  11237.     
  11238.     This is part of a series of routines use the low level functions
  11239.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers directly.
  11240.     pr_putc() returns the same status that is returned by blprstat().  Be
  11241.     sure to use pr_set() to set which LPT is to be accessed.  Note that
  11242.     the library defaults to LPT1:, and pr_set() may be ignored if that
  11243.     printer is to be used.
  11244.     
  11245.     
  11246.     EXAMPLE
  11247.     
  11248.             int r;
  11249.     
  11250.             pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11251.             r = pr_putc('Y');
  11252.             pr_eject();
  11253.     
  11254.     
  11255.     SEE ALSO: pr_nl(), pr_puts(), pr_line(), pr_eject(), pr_carret(),
  11256.               pr_set()
  11257.  
  11258.  
  11259.  
  11260.  
  11261.  
  11262.  
  11263.  
  11264.  
  11265.  
  11266.  
  11267.  
  11268.  
  11269.  
  11270.  
  11271.  
  11272.  
  11273.  
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.  
  11281.  
  11282.  
  11283.  
  11284.  
  11285.  
  11286.  
  11287. PR_PUTLN.FNC - Thu 23 Nov 89 00:20 - Page 172:  
  11288.  
  11289.     NAME
  11290.     
  11291.             pr_putline -- print a string, and a cr/lf to the printer
  11292.     
  11293.     
  11294.     PROTOTYPED IN:  mflsys.h
  11295.     
  11296.     
  11297.     SYNOPSIS
  11298.     
  11299.             pr_putline(str);  char *str;
  11300.     
  11301.     
  11302.     DESCRIPTION
  11303.     
  11304.     This is part of a series of routines use the low level functions
  11305.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers
  11306.     directly.  pr_putc() returns the same status that is returned
  11307.     by blprstat().  Be sure to use pr_set() to set which LPT is
  11308.     to be accessed.  Note that the library defaults to LPT1:,
  11309.     and pr_set() may be ignored if that printer is to be used.
  11310.     
  11311.     
  11312.     EXAMPLE
  11313.     
  11314.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11315.                pr_putline("Hello World");
  11316.                pr_eject();
  11317.     
  11318.     
  11319.     SEE ALSO: pr_nl(), pr_puts(), pr_eject(), pr_carret(), pr_set(),
  11320.               pr_putc()
  11321.  
  11322.  
  11323.  
  11324.  
  11325.  
  11326.  
  11327.  
  11328.  
  11329.  
  11330.  
  11331.  
  11332.  
  11333.  
  11334.  
  11335.  
  11336.  
  11337.  
  11338.  
  11339.  
  11340.  
  11341.  
  11342.  
  11343.  
  11344.  
  11345.  
  11346.  
  11347.  
  11348.  
  11349.  
  11350.  
  11351.  
  11352.  
  11353. PR_PUTS.FNC - Thu 23 Nov 89 00:20 - Page 173:  
  11354.  
  11355.     NAME
  11356.     
  11357.             pr_puts -- print a string to the printer
  11358.     
  11359.     
  11360.     PROTOTYPED IN:  mflsys.h
  11361.     
  11362.     
  11363.     SYNOPSIS
  11364.     
  11365.             pr_puts(str);     char *str;
  11366.     
  11367.     
  11368.     DESCRIPTION
  11369.     
  11370.     This is part of a series of routines use the low level functions
  11371.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers
  11372.     directly.  pr_putc() returns the same status that is returned
  11373.     by blprstat().  Be sure to use pr_set() to set which LPT is
  11374.     to be accessed.  Note that the library defaults to LPT1:,
  11375.     and pr_set() may be ignored if that printer is to be used.
  11376.     
  11377.     
  11378.     EXAMPLE
  11379.     
  11380.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11381.                pr_puts("Hello World");
  11382.     
  11383.     
  11384.     SEE ALSO: pr_nl(), pr_putline(), pr_eject(), pr_carret(), pr_set(),
  11385.               pr_putc()
  11386.  
  11387.  
  11388.  
  11389.  
  11390.  
  11391.  
  11392.  
  11393.  
  11394.  
  11395.  
  11396.  
  11397.  
  11398.  
  11399.  
  11400.  
  11401.  
  11402.  
  11403.  
  11404.  
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412.  
  11413.  
  11414.  
  11415.  
  11416.  
  11417.  
  11418.  
  11419. PR_SET.FNC - Thu 23 Nov 89 00:20 - Page 174:  
  11420.  
  11421.     NAME
  11422.     
  11423.             pr_set -- set the number of the current printer
  11424.     
  11425.     
  11426.     PROTOTYPED IN:  mflsys.h
  11427.     
  11428.     
  11429.     SYNOPSIS
  11430.     
  11431.             pr_set(num);      int num 0, 1, or 2
  11432.     
  11433.     
  11434.     DESCRIPTION
  11435.     
  11436.     This is part of a series of routines use the low level functions
  11437.     blpr() and blprstat() to access the LPT? ROM-BIOS drivers directly.
  11438.     pr_putc() returns the same status that is returned by blprstat().  Be
  11439.     sure to use pr_set() to set which LPT is to be accessed.  Note that
  11440.     the library defaults to LPT1:, and pr_set() may be ignored if that
  11441.     printer is to be used.
  11442.     
  11443.     
  11444.     EXAMPLE
  11445.     
  11446.                pr_set(LP1);        /* LP1, LP2, LP3 defined in smdefs.h */
  11447.                pr_putline("Hello World");
  11448.                pr_eject();
  11449.     
  11450.     
  11451.     SEE ALSO: pr_nl(), pr_puts(), pr_line(), pr_eject(), pr_carret(),
  11452.               pr_putc()
  11453.  
  11454.  
  11455.  
  11456.  
  11457.  
  11458.  
  11459.  
  11460.  
  11461.  
  11462.  
  11463.  
  11464.  
  11465.  
  11466.  
  11467.  
  11468.  
  11469.  
  11470.  
  11471.  
  11472.  
  11473.  
  11474.  
  11475.  
  11476.  
  11477.  
  11478.  
  11479.  
  11480.  
  11481.  
  11482.  
  11483.  
  11484.  
  11485. PRTSC.FNC - Thu 23 Nov 89 00:20 - Page 175:  
  11486.  
  11487.     NAME
  11488.     
  11489.             PrtSc -- prints the current text screen
  11490.     
  11491.     
  11492.     PROTOTYPED IN:  mflsys.h
  11493.     
  11494.     
  11495.     SYNOPSIS
  11496.     
  11497.             r = PrtSc();
  11498.             int r;          SUCCESS or ERROR if printing was already in
  11499.                             process 
  11500.     
  11501.     
  11502.     DESCRIPTION
  11503.     
  11504.     The PrtSc() function works identically to the keyboard key of the same
  11505.     name - it prints the contents of the current text screen. Note that the
  11506.     results when displaying graphics are undefined.
  11507.     
  11508.     
  11509.     EXAMPLE
  11510.     
  11511.             if (0 == getPrtSc_stat()) /* make sure not already printing */
  11512.                     PrtSc();
  11513.     
  11514.     
  11515.     SEE ALSO: getPrtSc_stat()
  11516.  
  11517.  
  11518.  
  11519.  
  11520.  
  11521.  
  11522.  
  11523.  
  11524.  
  11525.  
  11526.  
  11527.  
  11528.  
  11529.  
  11530.  
  11531.  
  11532.  
  11533.  
  11534.  
  11535.  
  11536.  
  11537.  
  11538.  
  11539.  
  11540.  
  11541.  
  11542.  
  11543.  
  11544.  
  11545.  
  11546.  
  11547.  
  11548.  
  11549.  
  11550.  
  11551. PUSHDIR.FNC - Thu 23 Nov 89 00:20 - Page 176:  
  11552.  
  11553.     NAME
  11554.     
  11555.             pushdir -- save current directory, then go to a new one
  11556.     
  11557.     
  11558.     PROTOTYPED IN:  mflfiles.h
  11559.     
  11560.     
  11561.     SYNOPSIS
  11562.     
  11563.             r = pushdir(newdir);
  11564.             int r;          returns: -1 if stack full
  11565.                                       0 if error
  11566.                                       1 if success (same drive)
  11567.                                       2 if success (changed drives)
  11568.             char *newdir;   directory (drive and path) to move to
  11569.     
  11570.     
  11571.     DESCRIPTION
  11572.     
  11573.     This function saves the current disk directories prior to moving around
  11574.     the disk system.  A static stack of eight directories is maintained
  11575.     for small and medium memory models, thirty-two for large and
  11576.     compact models.
  11577.     
  11578.     
  11579.     EXAMPLE
  11580.         
  11581.             if (0 < pushdir("c:utility"))
  11582.             {       /* do some stuff in C:UTILITY */
  11583.                     if (0 < popdir())
  11584.                             puts("We're back home!");
  11585.                     else    puts("oops...");
  11586.             }
  11587.             else  puts("Couldn't change to C:UTILITY");
  11588.     
  11589.     
  11590.     SEE ALSO: popdir
  11591.  
  11592.  
  11593.  
  11594.  
  11595.  
  11596.  
  11597.  
  11598.  
  11599.  
  11600.  
  11601.  
  11602.  
  11603.  
  11604.  
  11605.  
  11606.  
  11607.  
  11608.  
  11609.  
  11610.  
  11611.  
  11612.  
  11613.  
  11614.  
  11615.  
  11616.  
  11617. RDY_RCV.FNC - Thu 23 Nov 89 00:20 - Page 177:  
  11618.  
  11619.     NAME
  11620.     
  11621.             ready_rcv -- check for character availability
  11622.     
  11623.     
  11624.     PROTOTYPED IN:  mflsys.h
  11625.     
  11626.     
  11627.     SYNOPSIS
  11628.     
  11629.             x = ready_rcv(port);
  11630.     
  11631.     
  11632.     DESCRIPTION
  11633.     
  11634.     ready_rcv() is part of a set of very low level (direct port access)
  11635.     subroutines to enable I/O through COM1 through COM4.  Only setport()
  11636.     uses BIOS int 14H.  These functions are not intended to be the
  11637.     ultimate in async functions, but a starting point for an integrated
  11638.     set of async functions, and a means of getting at the serial port
  11639.     directly for speed and to work around the problems that some "clone"
  11640.     BIOS routines have in returning proper status values.  File "smdefs.h"
  11641.     contains #defines to handle these ports mnemonically.
  11642.     
  11643.     ready_rcv() returns a TRUE condition if a character is waiting to be
  11644.     read, but no error conditions are returned.
  11645.     
  11646.     If the program "loop" is short and fast enough, these functions will
  11647.     be ample to allow communications at up to 9600 baud. A program has
  11648.     already been implemented to communicate with a prom programmer at this
  11649.     rate, so it can be done.  However, when the program does not poll the
  11650.     receiver fast enough it is likely that characters may be lost and the
  11651.     maximum usable baud rate will be lower.  It is highly unlikely that
  11652.     baud rates less than 2400 baud will be necessary if the program is
  11653.     properly structured.
  11654.     
  11655.     
  11656.     EXAMPLE
  11657.     
  11658.                /* this routine receives characters from COM1 at one
  11659.                ** speed and resends them to COM2 at another speed */
  11660.     
  11661.                 unsigned char i;
  11662.     
  11663.                 setport(SER1, 0xe3);  /* set COM1 to 9600 baud, No parity,
  11664.                                       ** 8-bits, 1 stop bit */
  11665.                 setport(SER2, 0xc3);  /* set COM2 the same, but 4800 bps */
  11666.     
  11667.                 while(TRUE) {
  11668.                    if(!ready_rcv(SER1)) continue;  /* wait for a char */
  11669.                    i = readchar(SER1);     /* fetch it */
  11670.                    while(!ready_xmt(SER2));/* wait for xmtr to be ready */
  11671.                    writechar(SER2, i);  /* then send it */
  11672.                    }
  11673.     
  11674.     
  11675.     SEE ALSO: readchar(), ready_xmt(), setport(), writechar()
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.  
  11682.  
  11683. RDY_XMT.FNC - Thu 23 Nov 89 00:20 - Page 178:  
  11684.  
  11685.     NAME
  11686.     
  11687.             ready_xmt -- check if port can accept a char to send
  11688.     
  11689.     
  11690.     PROTOTYPED IN:  mflsys.h
  11691.     
  11692.     
  11693.     SYNOPSIS
  11694.     
  11695.             x = ready_xmt(port);
  11696.             int port;          port number
  11697.             int x;             TRUE if condition exists, else FALSE (0)
  11698.     
  11699.     
  11700.     DESCRIPTION
  11701.     
  11702.     ready_xmt() is part of a set of very low level (direct port access)
  11703.     subroutines to enable I/O through COM1 through COM4.  Only setport()
  11704.     uses BIOS int 14H.  These functions are not intended to be the
  11705.     ultimate in async functions, but a starting point for an integrated
  11706.     set of async functions, and a means of getting at the serial port
  11707.     directly for speed and to work around the problems that some "clone"
  11708.     BIOS routines have in returning proper status values.  File "smdefs.h"
  11709.     contains #defines to handle these ports mnemonically.
  11710.     
  11711.     ready_xmt() returns a TRUE condition if the transmit holding register
  11712.     is empty; i.e., the transmitter can accept a character to send.  In
  11713.     both these functions, the status returned is a result of reading the
  11714.     port status and masking all but the relevant bit.  These routines will
  11715.     NOT return errors such as overrun or parity.
  11716.     
  11717.     If the program "loop" is short and fast enough, these functions will
  11718.     be ample to allow communications at up to 9600 baud. A program has
  11719.     already been implemented to communicate with a prom programmer at this
  11720.     rate, so it can be done.  However, when the program does not poll the
  11721.     receiver fast enough it is likely that characters may be lost and the
  11722.     maximum usable baud rate will be lower.  It is highly unlikely that
  11723.     baud rates less than 2400 baud will be necessary if the program is
  11724.     properly structured.
  11725.  
  11726.  
  11727.  
  11728.  
  11729.  
  11730.  
  11731.  
  11732.  
  11733.  
  11734.  
  11735.  
  11736.  
  11737.  
  11738.  
  11739.  
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.  
  11746.  
  11747.  
  11748.  
  11749. RDY_XMT.FNC - Thu 23 Nov 89 00:20 - Page 179:  
  11750.  
  11751.  
  11752.     EXAMPLE
  11753.     
  11754.                /* this routine receives characters from COM1 at one
  11755.                ** speed and resends them to COM2 at another speed */
  11756.     
  11757.                 unsigned char i;
  11758.     
  11759.                 setport(SER1, 0xe3);  /* set COM1 to 9600 baud, No parity,
  11760.                                       ** 8-bits, 1 stop bit */
  11761.                 setport(SER2, 0xc3);  /* set COM2 the same, but 4800 bps */
  11762.     
  11763.                 while(TRUE) {
  11764.                    if(!ready_rcv(SER1)) continue;  /* wait for a char */
  11765.                    i = readchar(SER1);     /* fetch it */
  11766.                    while(!ready_xmt(SER2));/* wait for xmtr to be ready */
  11767.                    writechar(SER2, i);  /* then send it */
  11768.                    }
  11769.     
  11770.     
  11771.     SEE ALSO: readchar(), ready_rcv(), setport(), writechar()
  11772.  
  11773.  
  11774.  
  11775.  
  11776.  
  11777.  
  11778.  
  11779.  
  11780.  
  11781.  
  11782.  
  11783.  
  11784.  
  11785.  
  11786.  
  11787.  
  11788.  
  11789.  
  11790.  
  11791.  
  11792.  
  11793.  
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.  
  11802.  
  11803.  
  11804.  
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.  
  11812.  
  11813.  
  11814.  
  11815. READCHAR.FNC - Thu 23 Nov 89 00:20 - Page 180:  
  11816.  
  11817.     NAME
  11818.     
  11819.             readchar -- read a character from serial port
  11820.     
  11821.     
  11822.     PROTOTYPED IN:  mflsys.h
  11823.     
  11824.     
  11825.     SYNOPSIS
  11826.     
  11827.             r = readchar(port);
  11828.             unsigned char r;   character to send or receive
  11829.             int port;          port number
  11830.     
  11831.     
  11832.     DESCRIPTION
  11833.     
  11834.     readchar() is part of a set of very low level (direct port access)
  11835.     subroutines to enable I/O through COM1 through COM4.  Only setport()
  11836.     uses BIOS int 14H.  These functions are not intended to be the
  11837.     ultimate in async functions, but a starting point for an integrated
  11838.     set of async functions, and a means of getting at the serial port
  11839.     directly for speed and to work around the problems that some "clone"
  11840.     BIOS routines have in returning proper status values.  File "smdefs.h"
  11841.     contains #defines to handle these ports mnemonically.
  11842.     
  11843.     readchar() will return the character waiting in the receiver
  11844.     register of the port.  It is returned as an unsigned char
  11845.     to facilitate 8-bit binary transfer protocols.
  11846.     
  11847.     If the program "loop" is short and fast enough, these functions
  11848.     will be ample to allow communications at up to 9600 baud.
  11849.     A program has already been implemented to communicate with a
  11850.     prom programmer at this rate, so it can be done.  However,
  11851.     when the program does not poll the receiver fast enough it
  11852.     is likely that characters may be lost and the maximum usable
  11853.     baud rate will be lower.  It is highly unlikely that baud rates
  11854.     less than 2400 baud will be necessary if the program is properly
  11855.     structured.
  11856.  
  11857.  
  11858.  
  11859.  
  11860.  
  11861.  
  11862.  
  11863.  
  11864.  
  11865.  
  11866.  
  11867.  
  11868.  
  11869.  
  11870.  
  11871.  
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.  
  11878.  
  11879.  
  11880.  
  11881. READCHAR.FNC - Thu 23 Nov 89 00:20 - Page 181:  
  11882.  
  11883.  
  11884.     EXAMPLE
  11885.     
  11886.                /* this routine receives characters from COM1 at one
  11887.                ** speed and resends them to COM2 at another speed */
  11888.     
  11889.                 unsigned char i;
  11890.     
  11891.                 setport(SER1, 0xe3);  /* set COM1 to 9600 baud, No parity,
  11892.                                       ** 8-bits, 1 stop bit */
  11893.                 setport(SER2, 0xc3);  /* set COM2 the same, but 4800 bps */
  11894.     
  11895.                 while(TRUE) {
  11896.                    if(!ready_rcv(SER1)) continue;  /* wait for a char */
  11897.                    i = readchar(SER1);     /* fetch it */
  11898.                    while(!ready_xmt(SER2));/* wait for xmtr to be ready */
  11899.                    writechar(SER2, i);  /* then send it */
  11900.                    }
  11901.     
  11902.     
  11903.     SEE ALSO: ready_xmt(), ready_rcv(), setport(), writechar()
  11904.  
  11905.  
  11906.  
  11907.  
  11908.  
  11909.  
  11910.  
  11911.  
  11912.  
  11913.  
  11914.  
  11915.  
  11916.  
  11917.  
  11918.  
  11919.  
  11920.  
  11921.  
  11922.  
  11923.  
  11924.  
  11925.  
  11926.  
  11927.  
  11928.  
  11929.  
  11930.  
  11931.  
  11932.  
  11933.  
  11934.  
  11935.  
  11936.  
  11937.  
  11938.  
  11939.  
  11940.  
  11941.  
  11942.  
  11943.  
  11944.  
  11945.  
  11946.  
  11947. READDIR.FNC - Thu 23 Nov 89 00:20 - Page 182:  
  11948.  
  11949.     NAME
  11950.     
  11951.             readdir  -- read directory entries
  11952.     
  11953.     
  11954.     PROTOTYPED IN:  mflfiles.h
  11955.     
  11956.     
  11957.     SYNOPSIS
  11958.     
  11959.             r=readdir(d1);
  11960.             struct FIND *r; information about this directory entry
  11961.             DOS_DIR *d1;    directory file pointer
  11962.     
  11963.     
  11964.     DESCRIPTION
  11965.     
  11966.     This function is part of a group of functions designed to make reading
  11967.     DOS directories almost as simple as reading normal files.
  11968.     
  11969.     The readdir() function reads sequential entries from the open
  11970.     directory whose file pointer is passed, much as fgets() reads
  11971.     sequential lines of text from a normal file. The dd_loc element in
  11972.     the DOS_DIR structure is updated as each is read. After the last
  11973.     directory entry is read (i.e. dd_loc == dd_size), subsequent calls
  11974.     to readdir() will return NULL. Entries are read in normal find_t
  11975.     structures as used by the other _dos_findfirst/next routines.
  11976.     
  11977.     The readdir() function sets the DFerr global variable depending on
  11978.     their return status. The error codes in ERROR.H are used along with
  11979.     EOF and SUCCESS.
  11980.     
  11981.     
  11982.     EXAMPLE
  11983.     
  11984.             char *name[] = "C:\looney\bin";
  11985.             DOS_DIR *dirp;
  11986.             struct find_t *ffblk;
  11987.     
  11988.             if(dirp=opendir(name))
  11989.             {
  11990.                 printf("%s contains %d entries\n", name, dirp->dd_size);
  11991.                 while (ffblk=readdir(dirp))
  11992.                 {
  11993.                     printf("%3d - %s\n", dirp->dd_loc, ffblk->name);
  11994.                 }
  11995.                 closedir(dirp);
  11996.             }
  11997.     
  11998.     
  11999.     SEE ALSO: opendir(), closedir()
  12000.  
  12001.  
  12002.  
  12003.  
  12004.  
  12005.  
  12006.  
  12007.  
  12008.  
  12009.  
  12010.  
  12011.  
  12012.  
  12013. REBOOT.FNC - Thu 23 Nov 89 00:20 - Page 183:  
  12014.  
  12015.     NAME
  12016.     
  12017.             reboot -- force a warm or cold reboot
  12018.     
  12019.     
  12020.     PROTOTYPED IN:  mflsys.h
  12021.     
  12022.     
  12023.     SYNOPSIS
  12024.     
  12025.             void reboot(t);
  12026.             int t;          type of reboot, WARM or COLD (see MFLSYS.H)
  12027.     
  12028.     
  12029.     DESCRIPTION
  12030.     
  12031.     The reboot() function does just what it says - forces a warm (Ctrl-Alt-
  12032.     Del style) or cold (big red switch style) reboot.
  12033.     
  12034.     
  12035.     EXAMPLE
  12036.     
  12037.             if (disaster == minor)
  12038.                     reboot(WARM);
  12039.             else    reboot(COLD);
  12040.  
  12041.  
  12042.  
  12043.  
  12044.  
  12045.  
  12046.  
  12047.  
  12048.  
  12049.  
  12050.  
  12051.  
  12052.  
  12053.  
  12054.  
  12055.  
  12056.  
  12057.  
  12058.  
  12059.  
  12060.  
  12061.  
  12062.  
  12063.  
  12064.  
  12065.  
  12066.  
  12067.  
  12068.  
  12069.  
  12070.  
  12071.  
  12072.  
  12073.  
  12074.  
  12075.  
  12076.  
  12077.  
  12078.  
  12079. REPCHAR.FNC - Thu 23 Nov 89 00:20 - Page 184:  
  12080.  
  12081.     NAME
  12082.     
  12083.             repchar -- repeat a character n times to fd
  12084.     
  12085.     
  12086.     PROTOTYPED IN:  mflstrng.h
  12087.     
  12088.     
  12089.     SYNOPSIS
  12090.     
  12091.             void repchar(chr, qty, fd);
  12092.             char chr;       character to send
  12093.             int qty;        number of characters to send
  12094.             FILE *fd;       file descriptor of output channel
  12095.     
  12096.     
  12097.     DESCRIPTION
  12098.     
  12099.     This function sends qty number of chr to fd, which is usually
  12100.     stdout, stderr, or an open file.  Maximum qty is 128.
  12101.     If qty > 128, it will be truncated to 128.  This limit is due
  12102.     to an internal string buffer.  For speed, the string is filled
  12103.     and then fputs() is called to output the data as a string.
  12104.     
  12105.     
  12106.     EXAMPLE
  12107.     
  12108.           repchar('X', 50, stdout);
  12109.     
  12110.           /* to output a double horizontal line: */
  12111.     
  12112.           #include <mflconio.h>
  12113.           repchar(DHLINE, 50, stdout);
  12114.  
  12115.  
  12116.  
  12117.  
  12118.  
  12119.  
  12120.  
  12121.  
  12122.  
  12123.  
  12124.  
  12125.  
  12126.  
  12127.  
  12128.  
  12129.  
  12130.  
  12131.  
  12132.  
  12133.  
  12134.  
  12135.  
  12136.  
  12137.  
  12138.  
  12139.  
  12140.  
  12141.  
  12142.  
  12143.  
  12144.  
  12145. RIGHT.FNC - Thu 23 Nov 89 00:20 - Page 185:  
  12146.  
  12147.     NAME
  12148.     
  12149.             right -- return rightmost characters
  12150.     
  12151.     
  12152.     PROTOTYPED IN:  mflstrng.h
  12153.     
  12154.     
  12155.     SYNOPSIS
  12156.     
  12157.             s = right(string,n);
  12158.             char *s;        target string
  12159.             char *string;   source string
  12160.             int n;          number of characters
  12161.     
  12162.     
  12163.     DESCRIPTION
  12164.     
  12165.     This is an emulation of the BASIC "RIGHT$" function. It returns a
  12166.     right-justified substring of the specified string. This function uses
  12167.     the stralloc() funtion to allocate memory for the returned string.
  12168.     This memory is maintained in a circular pool and reused. See
  12169.     stralloc() for further information. Use strdup() or strcpy() to save
  12170.     the returned string in more permanent storage.
  12171.     
  12172.     
  12173.     EXAMPLE
  12174.     
  12175.             char *a;
  12176.             char *b = "Hardware";
  12177.             a = right(b,2);
  12178.             puts(a);
  12179.             /* prints "re"       */
  12180.     
  12181.     
  12182.     SEE ALSO: left(), mid(), string_add(), str_init(), stralloc(),
  12183.               str_free()
  12184.  
  12185.  
  12186.  
  12187.  
  12188.  
  12189.  
  12190.  
  12191.  
  12192.  
  12193.  
  12194.  
  12195.  
  12196.  
  12197.  
  12198.  
  12199.  
  12200.  
  12201.  
  12202.  
  12203.  
  12204.  
  12205.  
  12206.  
  12207.  
  12208.  
  12209.  
  12210.  
  12211. RINDEX.FNC - Thu 23 Nov 89 00:20 - Page 186:  
  12212.  
  12213.     NAME
  12214.     
  12215.             rindex -- offset of rightmost char in a string
  12216.     
  12217.     
  12218.     DEFINED IN:  mflstrng.h
  12219.     
  12220.     
  12221.     SYNOPSIS
  12222.     
  12223.              r = rindex(s,c);
  12224.              int r;          offset (index) of rightmost occurance of
  12225.                              char c in string s, -1 if unsuccessful
  12226.              char *s;        string to search
  12227.              char c;         character for which to search
  12228.     
  12229.     
  12230.     DESCRIPTION
  12231.     
  12232.     This is one of the macros included in MFLSTRNG.H.  Note that rindex()
  12233.     is available as a function in many systems and may return an integer
  12234.     offset, as done here, or may simply be aliases for strchr() and
  12235.     chrrchr(), respectively. It is provided here to aid portability, but
  12236.     may need to be modified or undefined depending on the original
  12237.     implementation.
  12238.     
  12239.     
  12240.     EXAMPLES
  12241.         
  12242.                 int offset;
  12243.     
  12244.                 offset=rindex("ABCDEDCBA", 'C');    /* returns 6    */
  12245.     
  12246.     
  12247.     SEE ALSO: index()
  12248.     
  12249.  
  12250.  
  12251.  
  12252.  
  12253.  
  12254.  
  12255.  
  12256.  
  12257.  
  12258.  
  12259.  
  12260.  
  12261.  
  12262.  
  12263.  
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.  
  12275.  
  12276.  
  12277. RMALLWS.FNC - Thu 23 Nov 89 00:20 - Page 187:  
  12278.  
  12279.     NAME
  12280.     
  12281.             rmallws --  remove all whitespace from string
  12282.     
  12283.     
  12284.     PROTOTYPED IN:  mflstrng.h
  12285.     
  12286.     
  12287.     SYNOPSIS
  12288.     
  12289.             str=rmallws(str);
  12290.             char *str;     string to modify
  12291.     
  12292.     
  12293.     DESCRIPTION
  12294.     
  12295.     This string function modifys the specified string in place.  White
  12296.     space is defined as the space character, tab character, vertical tab,
  12297.     linefeed, carriage return, and formfeed.  String size is limited to
  12298.     255 characters, although the source code can be modified to increase
  12299.     or decrease that.  If the string exceeds that size, it is truncated.
  12300.     Note that all strings are modified "in place" and all functions return
  12301.     a pointer to the modified string.
  12302.     
  12303.     
  12304.     EXAMPLE
  12305.     
  12306.             char string[] = "   This is a string   \n";
  12307.     
  12308.             rmallws(string); /* returns "Thisisastring" */
  12309.     
  12310.     
  12311.     SEE ALSO: rmlead(), rmtrail(), lv1ws()
  12312.  
  12313.  
  12314.  
  12315.  
  12316.  
  12317.  
  12318.  
  12319.  
  12320.  
  12321.  
  12322.  
  12323.  
  12324.  
  12325.  
  12326.  
  12327.  
  12328.  
  12329.  
  12330.  
  12331.  
  12332.  
  12333.  
  12334.  
  12335.  
  12336.  
  12337.  
  12338.  
  12339.  
  12340.  
  12341.  
  12342.  
  12343. RMLEAD.FNC - Thu 23 Nov 89 00:20 - Page 188:  
  12344.  
  12345.     NAME
  12346.     
  12347.             rmlead  -- remove leading whitespace from string
  12348.     
  12349.     
  12350.     PROTOTYPED IN:  mflstrng.h
  12351.     
  12352.     
  12353.     SYNOPSIS
  12354.     
  12355.             str=rmlead(str);
  12356.             char *str;     string to modify
  12357.     
  12358.     
  12359.     DESCRIPTION
  12360.     
  12361.     This string function will modify the specified string in place.
  12362.     White space is defined as the space character, tab character, vertical
  12363.     tab, linefeed, carriage return, and formfeed.  String size is limited
  12364.     to 255 characters, although the source code can be modified to
  12365.     increase or decrease that.  If the string exceeds that size, it is
  12366.     truncated.  Note that all strings are modified "in place" and all
  12367.     functions return a pointer to the modified string.
  12368.     
  12369.     
  12370.     EXAMPLE
  12371.     
  12372.             char string[] = "   This is a string   \n";
  12373.     
  12374.             rmlead(string);  /* returns "This is a string   \n" */
  12375.     
  12376.     
  12377.     SEE ALSO rmallws(), rmtrail(), lv1ws()
  12378.  
  12379.  
  12380.  
  12381.  
  12382.  
  12383.  
  12384.  
  12385.  
  12386.  
  12387.  
  12388.  
  12389.  
  12390.  
  12391.  
  12392.  
  12393.  
  12394.  
  12395.  
  12396.  
  12397.  
  12398.  
  12399.  
  12400.  
  12401.  
  12402.  
  12403.  
  12404.  
  12405.  
  12406.  
  12407.  
  12408.  
  12409. RMTICK.FNC - Thu 23 Nov 89 00:20 - Page 189:  
  12410.  
  12411.     NAME
  12412.     
  12413.             removetick -- remove a timer interrupt service routine
  12414.     
  12415.     
  12416.     PROTOTYPED IN:  mfltime.h
  12417.     
  12418.     
  12419.     SYNOPSIS
  12420.     
  12421.             void removetick();
  12422.     
  12423.     
  12424.     DESCRIPTION
  12425.     
  12426.     "ticker" is not actually a C function, but a routine which is
  12427.     installed on interrupt 1CH.  At each interrupt (18.21 times per
  12428.     second) this routine decrements an integer (16 bits) whose address was
  12429.     passed during installation.  The C program can load and test this
  12430.     integer at any time to perform time-based operations.  When the
  12431.     variable is decremented to zero, it is not decremented any further;
  12432.     i.e., no underflow occurs. Therefore, the integer is actually an
  12433.     unsigned integer with a maximum count of 65535, or (65535/18.2)
  12434.     seconds. installtick() installs the ticker on interrupt 1CH and saves
  12435.     the address of the passed variable. removetick() restores the
  12436.     interrupt 1CH vector to its original state. Any other routines already
  12437.     installed on this vector are executed after ticker, since the ticker
  12438.     chains to the original vector after execution.
  12439.     
  12440.     
  12441.     EXAMPLE
  12442.     
  12443.             int  counter;
  12444.     
  12445.             main() {
  12446.                  installtick(&counter);
  12447.                  counter = 18 * 10;  /* about 10 seconds */
  12448.                  while(counter > 0); /* delay here */
  12449.                  removetick();
  12450.             }
  12451.     
  12452.     
  12453.     CAVEAT
  12454.     
  12455.     It is imperative to call removetick() BEFORE terminating the program,
  12456.     Otherwise, the system will crash!
  12457.     
  12458.     
  12459.     SEE ALSO: ctlbrk(), criterr(), installtick()
  12460.     
  12461.  
  12462.  
  12463.  
  12464.  
  12465.  
  12466.  
  12467.  
  12468.  
  12469.  
  12470.  
  12471.  
  12472.  
  12473.  
  12474.  
  12475. RMTRAIL.FNC - Thu 23 Nov 89 00:20 - Page 190:  
  12476.  
  12477.     NAME
  12478.     
  12479.             rmtrail --  remove trailing whitespace from string
  12480.     
  12481.     
  12482.     PROTOTYPED IN:  mflstrng.h
  12483.     
  12484.     
  12485.     SYNOPSIS
  12486.     
  12487.             str=rmtrail(str);
  12488.             char *str;     string to modify
  12489.     
  12490.     
  12491.     DESCRIPTION
  12492.     
  12493.     This string function will modify the specified string in place.
  12494.     White space is defined as the space character, tab character, vertical
  12495.     tab, linefeed, carriage return, and formfeed.  String size is limited
  12496.     to 255 characters, although the source code can be modified to
  12497.     increase or decrease that.  If the string exceeds that size, it is
  12498.     truncated.  Note that all strings are modified "in place" and all
  12499.     functions return a pointer to the modified string.
  12500.     
  12501.     
  12502.     EXAMPLE
  12503.     
  12504.             char string[] = "   This is a string   \n";
  12505.     
  12506.             rmtail(string);  /* returns "   This is a string" */
  12507.     
  12508.     
  12509.     SEE ALSO: rmallws(), rmlead(), lv1ws()
  12510.  
  12511.  
  12512.  
  12513.  
  12514.  
  12515.  
  12516.  
  12517.  
  12518.  
  12519.  
  12520.  
  12521.  
  12522.  
  12523.  
  12524.  
  12525.  
  12526.  
  12527.  
  12528.  
  12529.  
  12530.  
  12531.  
  12532.  
  12533.  
  12534.  
  12535.  
  12536.  
  12537.  
  12538.  
  12539.  
  12540.  
  12541. RSTUCLK.FNC - Thu 23 Nov 89 00:20 - Page 191:  
  12542.  
  12543.     NAME
  12544.     
  12545.             restart_uclock -- re-initialize the microsecond clock
  12546.     
  12547.     
  12548.     PROTOTYPED IN:  mfltime.h
  12549.     
  12550.     
  12551.     SYNOPSIS
  12552.     
  12553.                     restart_uclock();
  12554.     
  12555.     
  12556.     DESCRIPTION
  12557.     
  12558.     This is part of a group of functions that implement timing functions
  12559.     with an accuracy of one microsecond on IBM and closely compatible
  12560.     computers. To function properly, these functions require the host
  12561.     system to use either an 8253 or 8254 counter/timer chip based at I/O
  12562.     address 40h to generate the 18.2 Hz system interrupt used by DOS.
  12563.     These functions further assume that DOS uses the four bytes at 40:6C
  12564.     for its timekeeping function. These have proven to be safe assumptions
  12565.     for all IBM PC's and PS/2's, Compaq's, as well as most other clone
  12566.     computers and single-board computers designed for MS/PC-DOS
  12567.     compatibility. The sole exception is msec_pause() which requires the
  12568.     counter/timer chip but makes no other assumptions.
  12569.     
  12570.     The usec_clock() function relies on data which rolls over at
  12571.     midnight each day and can handle this. However, if a program is to
  12572.     run continuously for many days, it becomes necessary to take
  12573.     action to prevent internal overflow. This may be done by resetting
  12574.     the internal registers used by usec_clock() at least once per day
  12575.     by calling restart_uclock().
  12576.     
  12577.     
  12578.     EXAMPLE
  12579.         
  12580.             restart_uclock();
  12581.     
  12582.     
  12583.     SEE ALSO: usec_clock(), restart_uclock(), usec_delay(),
  12584.               usec_difftime(), usec_timeout(), msec_pause()
  12585.  
  12586.  
  12587.  
  12588.  
  12589.  
  12590.  
  12591.  
  12592.  
  12593.  
  12594.  
  12595.  
  12596.  
  12597.  
  12598.  
  12599.  
  12600.  
  12601.  
  12602.  
  12603.  
  12604.  
  12605.  
  12606.  
  12607. SCLOSE.FNC - Thu 23 Nov 89 00:20 - Page 192:  
  12608.  
  12609.     NAME
  12610.     
  12611.             sclose -- close a stream
  12612.     
  12613.     
  12614.     PROTOTYPED IN:  mflfiles.h
  12615.     
  12616.     
  12617.     SYNOPSIS
  12618.     
  12619.             r = sclose(stream);
  12620.             int r;          SUCCESS or ERROR
  12621.             SFILE *stream;  stream to close
  12622.     
  12623.     
  12624.     DESCRIPTION
  12625.     
  12626.     The sclose() function is used to close streams opened with either the
  12627.     sfopen() or scopen() functions.
  12628.     
  12629.     
  12630.     EXAMPLE
  12631.     
  12632.             int serial_out();
  12633.             SFILE *infile, *outfile;
  12634.     
  12635.             infile  = sfopen("file.ext", "r");  /* input from a file     */
  12636.             outfile = scopen(serial_out, "w");  /* output to serial I/O  */
  12637.             ...
  12638.             if (SUCCESS != sclose(infile))
  12639.                     puts("couldn't close file.ext");
  12640.             if (SUCCESS != sclose(outfile))
  12641.                     puts("couldn't close serial I/O");
  12642.     
  12643.     
  12644.     SEE ALSO: sfopen(), scopen()
  12645.  
  12646.  
  12647.  
  12648.  
  12649.  
  12650.  
  12651.  
  12652.  
  12653.  
  12654.  
  12655.  
  12656.  
  12657.  
  12658.  
  12659.  
  12660.  
  12661.  
  12662.  
  12663.  
  12664.  
  12665.  
  12666.  
  12667.  
  12668.  
  12669.  
  12670.  
  12671.  
  12672.  
  12673. SCOPEN.FNC - Thu 23 Nov 89 00:20 - Page 193:  
  12674.  
  12675.     NAME
  12676.     
  12677.             scopen -- open a channel stream
  12678.     
  12679.     
  12680.     PROTOTYPED IN:  mflfiles.h
  12681.     
  12682.     
  12683.     SYNOPSIS
  12684.     
  12685.             r = scopen(gfunc,ufinc,mode);
  12686.             SFILE *r;       pointer to an SFILE record - equivalent to
  12687.                             fopen's FILE pointer - NULL in case of error
  12688.             int (*gfunc)(); function to call when reading (mode includes "r")
  12689.                             or writing (mode includes "w") streams
  12690.             int (*ufunc)(); function to call when "ungetting" (mode includes
  12691.                             "r" only) characters previously read from streams
  12692.             char *mode;     mode in which to open the streeam
  12693.     
  12694.     
  12695.     DESCRIPTION
  12696.     
  12697.     The scopen() function is used to open streams to channels. Comparable to
  12698.     sfopen(), scopen() is a general-purpose function to allow user-defined
  12699.     functions to interface with the rest of the MicroFirm Function Library's
  12700.     stream I/O package.
  12701.     
  12702.     
  12703.     EXAMPLE
  12704.     
  12705.             int is_char_rdy(), get_serial();   /* from some serial comms */
  12706.             SFILE *infile, *outfile;
  12707.             char buf[128];
  12708.     
  12709.             int s_in(void)
  12710.             {
  12711.                     while (!is_char_rdy())
  12712.                             ;
  12713.                     return get_serial();
  12714.             }
  12715.     
  12716.             int s_unget(int ch)
  12717.             {
  12718.                     return serial_unget(ch);
  12719.             }
  12720.     
  12721.             infile  = scopen(s_in,s_unget,"r"); /* input from serial I/O */
  12722.             outfile = sfopen("file.ext", "w");  /* output to a file      */
  12723.             sfinstall(infile, ucase_filt);      /* convert input to U.C. */
  12724.             crypt_install(outfile, "mykey", 0); /* encrypt output stream */
  12725.             sfgets(buf, 128, infile);           /* read a string         */
  12726.             sfputs(buf, outfile);               /* write it out          */
  12727.     
  12728.     
  12729.     
  12730.     SEE ALSO: sfopen(), sclose()
  12731.  
  12732.  
  12733.  
  12734.  
  12735.  
  12736.  
  12737.  
  12738.  
  12739. SET_LOC.FNC - Thu 23 Nov 89 00:20 - Page 194:  
  12740.  
  12741.     NAME
  12742.     
  12743.             setlocale  -- set country-specific information
  12744.     
  12745.     
  12746.     PROTOTYPED IN:  locale.h
  12747.     
  12748.     PORTABILITY: ANSI
  12749.     
  12750.     
  12751.     SYNOPSIS
  12752.     
  12753.             r = setlocale(category,locale);
  12754.             char *r;         current locale spec
  12755.             int category;    type of locale info to be set
  12756.             char *locale;    locale specification
  12757.     
  12758.     
  12759.     DESCRIPTION
  12760.     
  12761.     The setlocale() function specified in the ANSI draft. Although all
  12762.     categories are currently recognized, not all are supported.
  12763.     
  12764.     As defined by ANSI and in LOCALE.H, the lconv structure may be
  12765.     envisioned as a concatenation of several sub-structures containing
  12766.     information which will vary depending on locale. The valid
  12767.     categories are defined by `LC_' macros as follows:
  12768.     
  12769.     LC_ALL           This sets the entire lconv structure including all
  12770.                      sub-categories.
  12771.     
  12772.     LC_COLLATE       Not supported, this is designed to vary the action
  12773.                      of the string comparison functions.
  12774.     
  12775.     LC_CTYPE         Not supported, this designed to affect the action
  12776.                      of functions defined in CTYPE.H.
  12777.     
  12778.     LC_MONETARY      This contains formatting information for
  12779.                      expressing monetary values (see below).
  12780.     
  12781.     LC_NUMERIC       This contains formatting information for
  12782.                      expressing arithmetic values (see below).
  12783.     
  12784.     LC_TIME          This contains formatting information used
  12785.                      by strftime() and julian_to_dayname() (see below).
  12786.     
  12787.     To set an active locale, setlocale() is called with the category of
  12788.     locale to set and the name of the locale to set. If the name of the
  12789.     locale passed is NULL, the name of the currently active locale is
  12790.     returned. If the name of the locale passed is empty (""), the
  12791.     default locale is set (see below). Calling setlocale() returns the
  12792.     locale name of the locale which was set. Currently specified
  12793.     locales include:
  12794.     
  12795.     "C"              ANSI-mandated minimum locale, suitable for
  12796.                      minimum-functionality usage in English-speaking
  12797.                      countries.
  12798.     
  12799.     "USA"            The default (empty locale name string) locale.
  12800.  
  12801.  
  12802.  
  12803.  
  12804.  
  12805. SET_LOC.FNC - Thu 23 Nov 89 00:20 - Page 195:  
  12806.  
  12807.     
  12808.     To set a new or non-English locale, you must first add a structure
  12809.     of type lconv to the _lconv[] array in LOCALE.C, setting each of
  12810.     its category names (fields beginning with "s_") to the name of your
  12811.     new locale. This structure elements are as follows:
  12812.     
  12813.     char *s_all             Name of the locale returned by LC_ALL
  12814.     
  12815.     char *s_collate         Name of the locale returned by LC_COLLATE
  12816.     
  12817.     char *s_ctype           Name of the locale returned by LC_CTYPE
  12818.     
  12819.     char *s_monetary        Name of the locale returned by LC_MONETARY
  12820.     char *currency_symbol   String containing the locale's currency
  12821.                             symbol, e.g. "$" in the U.S.
  12822.     char *int_curr_symbol   String containing the locale's
  12823.                             international currency symbol, e.g. "USD"
  12824.                             in the U.S.
  12825.     char *mon_decimal_point String containing the locale's decimal
  12826.                             point, e.g. "." in the U.S.
  12827.     char *mon_thousands_sep String containing the locale's thousands
  12828.                             separator, e.g. "," in the U.S.
  12829.     char *mon_grouping      Although this is a string, only the first
  12830.                             character's ASCII value is used to
  12831.                             determine the size of character groupings in
  12832.                             specifying monetary values, i.e. for the
  12833.                             U.S. use "\3" to specify 3-character
  12834.                             groupings.
  12835.     char *positive_sign     String containing the positive symbol,
  12836.                             e.g. "+" in the U.S.
  12837.     char *negative_sign     String containing the negative symbol,
  12838.                             e.g. "-" in the U.S.
  12839.     char int_frac_digits    The number of digits to display for
  12840.                             fractional international monetary
  12841.                             quantities, e.g. 2 for the U.S.
  12842.     char frac_digits        The number of digits to display for
  12843.                             fractional monetary quantities, e.g. 2 for
  12844.                             the U.S.
  12845.     char p_cs_precedes      Whether the currency symbol precedes (1)
  12846.                             or follows (0) the value for positive
  12847.                             monetary values.
  12848.     char n_cs_precedes      Whether the currency symbol precedes (1)
  12849.                             or follows (0) the value for negative
  12850.                             monetary values.
  12851.     char p_sep_by_space     Whether the currency symbol is separated
  12852.                             by a space (1) or not (0) for positive
  12853.                             monetary values.
  12854.     char n_sep_by_space     Whether the currency symbol is separated
  12855.                             by a space (1) or not (0) for negative
  12856.                             monetary values.
  12857.     char p_sign_posn        Whether, for positive monetary values:
  12858.                             (0) parentheses surround the value and the
  12859.                             currency symbol,
  12860.                             (1) the positive sign precedes the value
  12861.                             and the currency symbol,
  12862.                             (2) the positive sign follows the value
  12863.                             and the currency symbol,
  12864.                             (3) the positive sign immediately precedes
  12865.                             the currency symbol, or
  12866.  
  12867.  
  12868.  
  12869.  
  12870.  
  12871. SET_LOC.FNC - Thu 23 Nov 89 00:20 - Page 196:  
  12872.  
  12873.                             (4) the positive sign immediately follows
  12874.                             the currency symbol.
  12875.     char n_sign_posn        Whether, for negative monetary values:
  12876.                             (0) parentheses surround the value and the
  12877.                             currency symbol,
  12878.                             (1) the negative sign precedes the value
  12879.                             and the currency symbol,
  12880.                             (2) the negative sign follows the value
  12881.                             and the currency symbol,
  12882.                             (3) the negative sign immediately precedes
  12883.                             the currency symbol, or
  12884.                             (4) the negative sign immediately follows
  12885.                             the currency symbol.
  12886.     char *s_numeric         Name of the locale returned by LC_NUMERIC
  12887.     char *decimal_point     String containing the locale's decimal
  12888.                             point, e.g. "." in the U.S.
  12889.     char *thousands_sep     String containing the locale's thousands
  12890.                             separator, e.g. "," in the U.S.
  12891.     char *grouping          Although this is a string, only the first
  12892.                             character's ASCII value is used to
  12893.                             determine the size of character groupings in
  12894.                             specifying arithmetic values, i.e. for the
  12895.                             U.S. use "\3" to specify 3-character
  12896.                             groupings.
  12897.     char *s_time            Name of the locale returned by LC_TIME
  12898.     char *day[7][2]         An array of weekday names, starting with
  12899.                             Sunday, and their abbreviations.
  12900.     char *month[12][2]      An array of month names, starting with
  12901.                             January, and their abbreviations.
  12902.     int  TZ_secs            Seconds to add to GMT to get local standard
  12903.                             time.
  12904.     int  DST_flag           0 if local standard time, 1 if local
  12905.                             daylight time.
  12906.     char *TZ_txt[2]         The local time zone names, both normal
  12907.                             ([0]) and daylight ([1]). Defaults to
  12908.                             "CST", "CDT".
  12909.     char tim_sep            Character used to separate time fields
  12910.                             (':').
  12911.     char *p_FMTA            Morning AM/PM indicator ("AM").
  12912.     char *p_FMTP            Evening AM/PM indicator ("PM").
  12913.     char *c_FORMAT          strftime() format string for standard
  12914.                             display. See STRFTIME.C for exact usage.
  12915.     char *x_FORMAT          strftime() format string for date display.
  12916.     char *X_FORMAT          strftime() format string for time display.
  12917.     char fmt_24             Indicates formatting of hours between midnight
  12918.                             and 1:00 AM. Zero indicates to display as
  12919.                             00:mm:ss, non-zero indicates to use 24:mm:ss.
  12920.     
  12921.  
  12922.  
  12923.  
  12924.  
  12925.  
  12926.  
  12927.  
  12928.  
  12929.  
  12930.  
  12931.  
  12932.  
  12933.  
  12934.  
  12935.  
  12936.  
  12937. SET_LOC.FNC - Thu 23 Nov 89 00:20 - Page 197:  
  12938.  
  12939.  
  12940.     LOCALE.C maintains a master locale for use by applications
  12941.     programs. This allows different locale categories to be mixed in
  12942.     the master locale. For example, the "USA" locale may be specified
  12943.     for monetary value formatting while the default "C" locale might be
  12944.     used for numeric values, thus avoiding the grouping and thousands
  12945.     separators in the LC_NUMERIC category of the "USA" locale. To
  12946.     access the master locale, the function localeconv() is called which
  12947.     returns a pointer to the master locale.
  12948.     
  12949.     The strftime() function uses an additional feature of setlocale(), the
  12950.     ability to use environment variables. Two environment variables are
  12951.     used, "TIMEZONE" and "DAYLIGHT". The TIMEZONE variable takes the form
  12952.     "NNN[+/-]TT[TTTT]DDD" where "NNN" is the name for the normal time zone,
  12953.     "DDD" is the name when using daylight savings time, and "TT[TTTT]" is
  12954.     the local offset from GMT in either hours (range: -24 to 24) or seconds.
  12955.     For example to set Pacific Time, use:
  12956.     
  12957.                      "SET TIMEZONE=PST8"            sets PST
  12958.                      "SET TIMEZONE=PST9PDT"         sets PDT
  12959.     
  12960.     The DAYLIGHT variable is set to either "0" or a non-zero numeric value
  12961.     to indicate whether daylight savings time is in effect. For example, if
  12962.     TIMEZONE were set as above for PDT, the use of PST could be forced by:
  12963.     
  12964.                       "SET DAYLIGHT=0"
  12965.     
  12966.     NOTES: When using the "USA" locale, "TZ_hrs" and "DST_flag" are set
  12967.     to default values of 6 and 0, respectively, corresponding to
  12968.     CST.
  12969.     
  12970.     When using the default "C" locale, "TZ_secs" and "DST_flag" are set to
  12971.     default values of 0 and 0, respectively.
  12972.     
  12973.     When using strftime(), note that the DST_flag in the master locale
  12974.     rather than the "tm_isdst" field of the local tm structure determines
  12975.     the time zone display.
  12976.     
  12977.     
  12978.     EXAMPLE
  12979.     
  12980.             struct lconv my_locale;
  12981.             setlocale(LC_ALL, NULL);         /* returns "C"                */
  12982.             my_locale = localeconv();        /* copy defaults              */
  12983.             my_locale.TZ_txt = {"PST","PDT"};/* set Pacific Daylight Time  */
  12984.             my_locale.TZ_secs=8*3600;
  12985.             my_locale.DST_flag = 1;
  12986.             my_locale.s_time = "CA dreaming";
  12987.             setlocale(LC_TIME, NULL);        /* returns "CA dreaming"      */
  12988.             setlocale(LC_ALL, "C");          /* returns "C", resets master */
  12989.     
  12990.     
  12991.     SEE ALSO: localeconv(), strftime(), tzset()
  12992.  
  12993.  
  12994.  
  12995.  
  12996.  
  12997.  
  12998.  
  12999.  
  13000.  
  13001.  
  13002.  
  13003. SETCAPS.FNC - Thu 23 Nov 89 00:20 - Page 198:  
  13004.  
  13005.     NAME
  13006.     
  13007.             setcaps -- set the capslock status on
  13008.     
  13009.     
  13010.     PROTOTYPED IN:  mflconio.h
  13011.     
  13012.     
  13013.     SYNOPSIS
  13014.     
  13015.             setcaps();
  13016.     
  13017.     
  13018.     DESCRIPTION
  13019.     
  13020.     This is part of a set of functions which manipulate the keyboardf
  13021.     status flags at 0000:417 and 0000:418.  setcaps() will force the caps
  13022.     lock flag ON, and clrcaps will force it off.
  13023.     
  13024.     
  13025.     EXAMPLE
  13026.                 setcaps();
  13027.                 if(kbstate(2)) puts("Caps lock is now set");
  13028.                 else puts("Caps lock is NOT set");
  13029.                 clrcaps();
  13030.                 puts("Caps lock should now be off");
  13031.     
  13032.     
  13033.     SEE ALSO _kbstate(), _kbstatus(), setnumlock(), clrnumlock(), clrcaps()
  13034.  
  13035.  
  13036.  
  13037.  
  13038.  
  13039.  
  13040.  
  13041.  
  13042.  
  13043.  
  13044.  
  13045.  
  13046.  
  13047.  
  13048.  
  13049.  
  13050.  
  13051.  
  13052.  
  13053.  
  13054.  
  13055.  
  13056.  
  13057.  
  13058.  
  13059.  
  13060.  
  13061.  
  13062.  
  13063.  
  13064.  
  13065.  
  13066.  
  13067.  
  13068.  
  13069. SETDTR.FNC - Thu 23 Nov 89 00:20 - Page 199:  
  13070.  
  13071.     NAME
  13072.     
  13073.             setdtr -- set state of data terminal ready flag
  13074.     
  13075.     
  13076.     PROTOTYPED IN:  mflsys.h
  13077.     
  13078.     
  13079.     SYNOPSIS
  13080.     
  13081.             void setdtr(port, mode);
  13082.             int port;        0, 1, 2, or 3 (for COM1-COM4)
  13083.             int mode;        TRUE to set flag, FALSE to clear flag
  13084.     
  13085.     
  13086.     DESCRIPTION
  13087.     
  13088.     This assembly language function provides direct access to the serial
  13089.     communications chips for the fastest access possible.  Each function
  13090.     sets a particular communications output bit to the condition stated by
  13091.     "mode". The port parameter may be specified as integers 0-3, or SER1
  13092.     to SER4 as defined in MFLDEFS.H.
  13093.     
  13094.     
  13095.     EXAMPLE
  13096.     
  13097.             int sport;        /* serial port */
  13098.     
  13099.             sport = SER2;     /* let it point to COM2 */
  13100.             setdtr(sport, YES);  /* take the modem offhook */
  13101.     
  13102.     
  13103.     SEE ALSO: setdtr()
  13104.  
  13105.  
  13106.  
  13107.  
  13108.  
  13109.  
  13110.  
  13111.  
  13112.  
  13113.  
  13114.  
  13115.  
  13116.  
  13117.  
  13118.  
  13119.  
  13120.  
  13121.  
  13122.  
  13123.  
  13124.  
  13125.  
  13126.  
  13127.  
  13128.  
  13129.  
  13130.  
  13131.  
  13132.  
  13133.  
  13134.  
  13135. SETFTIME.FNC - Thu 23 Nov 89 00:20 - Page 200:  
  13136.  
  13137.     NAME
  13138.     
  13139.             setftime -- set a file's time/date stamp
  13140.     
  13141.     
  13142.     PROTOTYPED IN:  mfltime.h
  13143.     
  13144.     
  13145.     PORTABILITY: TC
  13146.     
  13147.     
  13148.     SYNOPSIS
  13149.     
  13150.             r = setftime(fh, t);
  13151.             int r;           returns 0 if successful, else -1 and sets
  13152.                              errno
  13153.             int fh;          handle of file to check
  13154.             struct ftime *t; pointer to file time/date stamp structure
  13155.     
  13156.     
  13157.     DESCRIPTION
  13158.     
  13159.     This routine sets a file's time/date stamp. See MFLTIME.H for a
  13160.     description of the ftime structure.
  13161.     
  13162.     
  13163.     EXAMPLE
  13164.     
  13165.             struct ftime then;
  13166.             int fh;
  13167.     
  13168.             fh = open ("file.ext", O_RDONLY);
  13169.             if (ERROR == setftime(fh, &then))
  13170.                    puts("couldn't reset time/date stamp");
  13171.             }
  13172.     
  13173.     
  13174.     SEE ALSO: getftime(), touch(), get_filetime()
  13175.  
  13176.  
  13177.  
  13178.  
  13179.  
  13180.  
  13181.  
  13182.  
  13183.  
  13184.  
  13185.  
  13186.  
  13187.  
  13188.  
  13189.  
  13190.  
  13191.  
  13192.  
  13193.  
  13194.  
  13195.  
  13196.  
  13197.  
  13198.  
  13199.  
  13200.  
  13201. SETNMLOC.FNC - Thu 23 Nov 89 00:20 - Page 201:  
  13202.  
  13203.     NAME
  13204.     
  13205.             setnumlock -- Turns Numlock status flag on
  13206.     
  13207.     
  13208.     PROTOTYPED IN:  mflconio.h
  13209.     
  13210.     
  13211.     SYNOPSIS
  13212.     
  13213.             setnumlock();
  13214.     
  13215.     
  13216.     DESCRIPTION
  13217.     
  13218.     This is one of a set of functions which manipulate the keyboardf
  13219.     status flags at 0000:417 and 0000:418.  setnumlock() sets the numlock
  13220.     status flag on.
  13221.     
  13222.     
  13223.     EXAMPLE
  13224.                 setnumlock();
  13225.                 if(kbstate(2)) puts("Num lock is now set");
  13226.                 else puts("Num lock is NOT set");
  13227.                 clrnumlock();
  13228.                 puts("Num lock should now be off");
  13229.     
  13230.     
  13231.     SEE ALSO: clrcaps(), setcaps(), clrnumlock(), _kbstate(), _kbstatus()
  13232.  
  13233.  
  13234.  
  13235.  
  13236.  
  13237.  
  13238.  
  13239.  
  13240.  
  13241.  
  13242.  
  13243.  
  13244.  
  13245.  
  13246.  
  13247.  
  13248.  
  13249.  
  13250.  
  13251.  
  13252.  
  13253.  
  13254.  
  13255.  
  13256.  
  13257.  
  13258.  
  13259.  
  13260.  
  13261.  
  13262.  
  13263.  
  13264.  
  13265.  
  13266.  
  13267. SETPORT.FNC - Thu 23 Nov 89 00:20 - Page 202:  
  13268.  
  13269.     NAME
  13270.     
  13271.             setport -- set port configuration
  13272.     
  13273.     
  13274.     PROTOTYPED IN:  mflsys.h
  13275.     
  13276.     
  13277.     SYNOPSIS
  13278.     
  13279.             (void) setport(port, r);
  13280.             int port; port number
  13281.             int x; TRUE if condition exists, else FALSE (0)
  13282.     
  13283.     
  13284.     DESCRIPTION
  13285.     
  13286.     This is part of a set of very low level (direct port access)
  13287.     subroutines to enable I/O through COM1 through COM4.  Only setport()
  13288.     uses BIOS int 14H.  These functions are not intended to be the
  13289.     ultimate in async functions, but a starting point for an integrated
  13290.     set of async functions, and a means of getting at the serial port
  13291.     directly for speed and to work around the problems that some "clone"
  13292.     BIOS routines have in returning proper status values.  File "smdefs.h"
  13293.     contains #defines to handle these ports mnemonically.
  13294.     
  13295.     The value to use for the setport() function is an 8-bit
  13296.     value, bitwise organized as follows:
  13297.     
  13298.            bits 1,0:     10 = 7-bit data, 11 = 8-bit data
  13299.            bit  2:        0 = 1 stop bit, 1 = 2 stop bits
  13300.            bits 4,3:     x0 = No Parity, 01 = odd, 11 = even
  13301.            bits 7,6,5:   baud rate:
  13302.                          000 = 110 baud (use 2 stop bits)
  13303.                          001 = 150 baud
  13304.                          010 = 300 baud
  13305.                          011 = 600 baud
  13306.                          100 = 1200 baud
  13307.                          101 = 2400 baud
  13308.                          110 = 4800 baud
  13309.                          111 = 9600 baud
  13310.  
  13311.  
  13312.  
  13313.  
  13314.  
  13315.  
  13316.  
  13317.  
  13318.  
  13319.  
  13320.  
  13321.  
  13322.  
  13323.  
  13324.  
  13325.  
  13326.  
  13327.  
  13328.  
  13329.  
  13330.  
  13331.  
  13332.  
  13333. SETPORT.FNC - Thu 23 Nov 89 00:20 - Page 203:  
  13334.  
  13335.  
  13336.     EXAMPLE
  13337.     
  13338.              /* this routine receives characters from COM1 at one
  13339.              ** speed and resends them to COM2 at another speed */
  13340.     
  13341.              unsigned char i;
  13342.     
  13343.              setport(SER1, 0xe3);  /* set COM1 to 9600 baud, No parity,
  13344.                                       ** 8-bits, 1 stop bit */
  13345.              setport(SER2, 0xc3);  /* set COM2 the same, except 4800 baud */
  13346.     
  13347.              while(TRUE) {
  13348.                 if(!ready_rcv(SER1)) continue;  /* wait for a char */
  13349.                 i = readchar(SER1);     /* fetch it */
  13350.                 while(!ready_xmt(SER2));/* wait for xmittr to be ready */
  13351.                 writechar(SER2, i);  /* then send it */
  13352.              }
  13353.     
  13354.     
  13355.     SEE ALSO: ready_rcv(), ready_xmt()
  13356.  
  13357.  
  13358.  
  13359.  
  13360.  
  13361.  
  13362.  
  13363.  
  13364.  
  13365.  
  13366.  
  13367.  
  13368.  
  13369.  
  13370.  
  13371.  
  13372.  
  13373.  
  13374.  
  13375.  
  13376.  
  13377.  
  13378.  
  13379.  
  13380.  
  13381.  
  13382.  
  13383.  
  13384.  
  13385.  
  13386.  
  13387.  
  13388.  
  13389.  
  13390.  
  13391.  
  13392.  
  13393.  
  13394.  
  13395.  
  13396.  
  13397.  
  13398.  
  13399. SETRTS.FNC - Thu 23 Nov 89 00:20 - Page 204:  
  13400.  
  13401.     NAME
  13402.     
  13403.             setrts -- set state of ready to send flag
  13404.     
  13405.     
  13406.     PROTOTYPED IN:  mflsys.h
  13407.     
  13408.     
  13409.     SYNOPSIS
  13410.     
  13411.             void setrts(port, mode);
  13412.             int port;        0, 1, 2, or 3 (for COM1-COM4)
  13413.             int mode;        TRUE to set flag, FALSE to clear flag
  13414.     
  13415.     
  13416.     DESCRIPTION
  13417.     
  13418.     This assembly language function provides direct access to the serial
  13419.     communications chips for the fastest access possible.  The function
  13420.     sets the state of the ready to send flag. The port parameter may be
  13421.     specified as integers 0-3, or SER1 to SER4 as defined in <MFLDEFS.H>.
  13422.     
  13423.     
  13424.     EXAMPLE
  13425.     
  13426.             int sport;        /* serial port */
  13427.     
  13428.             sport = SER2;     /* let it point to COM2 */
  13429.             setrts(sport, YES);  /* take the modem offhook */
  13430.     
  13431.     
  13432.     SEE ALSO: setdtr()
  13433.  
  13434.  
  13435.  
  13436.  
  13437.  
  13438.  
  13439.  
  13440.  
  13441.  
  13442.  
  13443.  
  13444.  
  13445.  
  13446.  
  13447.  
  13448.  
  13449.  
  13450.  
  13451.  
  13452.  
  13453.  
  13454.  
  13455.  
  13456.  
  13457.  
  13458.  
  13459.  
  13460.  
  13461.  
  13462.  
  13463.  
  13464.  
  13465. SFGETC.FNC - Thu 23 Nov 89 00:20 - Page 205:  
  13466.  
  13467.     NAME
  13468.     
  13469.             sfgetc -- get a character from a stream
  13470.     
  13471.     
  13472.     PROTOTYPED IN:  mflfiles.h
  13473.     
  13474.     
  13475.     SYNOPSIS
  13476.     
  13477.             r = sfgetc(stream);
  13478.             int r;          character or EOF
  13479.             SFILE *stream;  stream from which to read
  13480.     
  13481.     
  13482.     DESCRIPTION
  13483.     
  13484.     The sfgetc() function is an exact analog of the normal fgetc() function
  13485.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13486.     
  13487.     
  13488.     EXAMPLE
  13489.     
  13490.             SFILE *infile;
  13491.             int ch;
  13492.     
  13493.             infile  = sfopen("file.ext", "r");  /* input from a file     */
  13494.             if (EOF == (ch = sfgetc(infile)))
  13495.                     puts("all done");
  13496.     
  13497.     
  13498.     SEE ALSO: sfopen(), scopen(), sclose(), sfgets(), sfread(), sfputc(),
  13499.               sfputs(), sfwrite(), sfinstall(), crypt_install(), ucase_filt,
  13500.               lcase_filt
  13501.  
  13502.  
  13503.  
  13504.  
  13505.  
  13506.  
  13507.  
  13508.  
  13509.  
  13510.  
  13511.  
  13512.  
  13513.  
  13514.  
  13515.  
  13516.  
  13517.  
  13518.  
  13519.  
  13520.  
  13521.  
  13522.  
  13523.  
  13524.  
  13525.  
  13526.  
  13527.  
  13528.  
  13529.  
  13530.  
  13531. SFGETS.FNC - Thu 23 Nov 89 00:20 - Page 206:  
  13532.  
  13533.     NAME
  13534.     
  13535.             sfgets -- get a string from a stream
  13536.     
  13537.     
  13538.     PROTOTYPED IN:  mflfiles.h
  13539.     
  13540.     
  13541.     SYNOPSIS
  13542.     
  13543.             r = sfgetc(buf,n,stream);
  13544.             char *r;        string which was read
  13545.             char *buf;      buffer to receive string
  13546.             int n;          maximum size plus 1 of received string
  13547.             SFILE *stream;  stream from which to read
  13548.     
  13549.     
  13550.     DESCRIPTION
  13551.     
  13552.     The sfgets() function is an exact analog of the normal fgets() function
  13553.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13554.     
  13555.     
  13556.     EXAMPLE
  13557.     
  13558.             SFILE *infile;
  13559.             char str[128];
  13560.     
  13561.             infile  = sfopen("file.ext", "r");  /* input from a file     */
  13562.             if (NULL == sfgets(str, 128, infile)))
  13563.                     puts("all done");
  13564.     
  13565.     
  13566.     SEE ALSO: sfopen(), scopen(), sclose(), sfgets(), sfread(), sfputc(),
  13567.               sfputs(), sfwrite(), sfinstall(), crypt_install(), ucase_filt,
  13568.               lcase_filt
  13569.  
  13570.  
  13571.  
  13572.  
  13573.  
  13574.  
  13575.  
  13576.  
  13577.  
  13578.  
  13579.  
  13580.  
  13581.  
  13582.  
  13583.  
  13584.  
  13585.  
  13586.  
  13587.  
  13588.  
  13589.  
  13590.  
  13591.  
  13592.  
  13593.  
  13594.  
  13595.  
  13596.  
  13597. SFINST.FNC - Thu 23 Nov 89 00:20 - Page 207:  
  13598.  
  13599.     NAME
  13600.     
  13601.             sfinstall -- install a user-defined stream filter
  13602.     
  13603.     
  13604.     PROTOTYPED IN:  mflfiles.h
  13605.     
  13606.     
  13607.     SYNOPSIS
  13608.     
  13609.             r = sfgetc(stream,filt);
  13610.             int r;          SUCCESS or ERROR
  13611.             SFILE *stream;  stream to be filtered
  13612.             SFILTER *filt;  filter to install
  13613.     
  13614.     
  13615.     DESCRIPTION
  13616.     
  13617.     The sfinstall() function allows user-defined filters to be installed in
  13618.     any stream opened using sfopen() or scopen(). Simple filters are
  13619.     installed by simply filling in the chain and (optionally) flush fields
  13620.     of an SFILTER structure and passing it to sfinstalll(). More complex
  13621.     filters which require initialization, etc. require dedicated
  13622.     installation functions which internally must call sfinstall(). An
  13623.     example of such a filter is the data encryption filter, installed using
  13624.     the crypt_install() function.
  13625.     
  13626.     Properly written filters can be chained indefinitely. Filter functions
  13627.     are invoked in a last-installed, first-executed sequence. When a stream
  13628.     is closed, the flush functions are invoked in the same order to clear
  13629.     any pending operations.
  13630.     
  13631.     
  13632.     EXAMPLE
  13633.     
  13634.             SFILE *infile;
  13635.     
  13636.             infile = sfopen("file.ext", "r");   /* input from a file      */
  13637.             crypt_install(infile, "keytxt", 0); /* encrypt using "keytxt" */
  13638.             sfinstall(infile, ucase_filt);      /* after converting to UC */
  13639.     
  13640.     
  13641.     SEE ALSO: sfopen(), scopen(), sclose(), crypt_install(), ucase_filt,
  13642.               lcase_filt
  13643.  
  13644.  
  13645.  
  13646.  
  13647.  
  13648.  
  13649.  
  13650.  
  13651.  
  13652.  
  13653.  
  13654.  
  13655.  
  13656.  
  13657.  
  13658.  
  13659.  
  13660.  
  13661.  
  13662.  
  13663. SFOPEN.FNC - Thu 23 Nov 89 00:20 - Page 208:  
  13664.  
  13665.     NAME
  13666.     
  13667.             sfopen -- open a stream
  13668.     
  13669.     
  13670.     PROTOTYPED IN:  mflfiles.h
  13671.     
  13672.     
  13673.     SYNOPSIS
  13674.     
  13675.             r = sfopen(fname,mode);
  13676.             SFILE *r;       pointer to an SFILE record - equivalent to fopen's
  13677.                             FILE pointer - NULL in case of error
  13678.             char *fname;    name of the file or stream to open
  13679.             char *mode;     mode in which to open the streeam
  13680.     
  13681.     
  13682.     DESCRIPTION
  13683.     
  13684.     The sfopen() function is an almost exact analog of the standard fopen()
  13685.     function, so it is appropriate to describe their differences:
  13686.     
  13687.     o  sfopen() returns an SFILE pointer while fopen() returns a FILE pointer.
  13688.     o  sfopen'ed files and streams are always opened in binary mode
  13689.     o  sfopen'ed files and streams are always read and written sequentially,
  13690.        i.e. there are no positioning commands comparable to fseek()
  13691.     o  sfopen'ing a file or stream in append mode is not permitted
  13692.     o  sfopen'ed files and streams allow user-defined filters to be installed,
  13693.        comparable to DOS command line pipes
  13694.     o  a comparable function, scopen() exists to open streams to channels,
  13695.        e.g. an SFILE pointer may transparently refer to an interrupt-driven
  13696.        serial I/O package
  13697.     
  13698.     
  13699.     EXAMPLE
  13700.     
  13701.             SFILE *infile;
  13702.     
  13703.             if (NULL == (infile = sfopen("file.ext", "r+")))
  13704.                     puts("couldn't open file.ext");
  13705.     
  13706.     
  13707.     SEE ALSO: scopen(), sclose()
  13708.  
  13709.  
  13710.  
  13711.  
  13712.  
  13713.  
  13714.  
  13715.  
  13716.  
  13717.  
  13718.  
  13719.  
  13720.  
  13721.  
  13722.  
  13723.  
  13724.  
  13725.  
  13726.  
  13727.  
  13728.  
  13729. SFPUTC.FNC - Thu 23 Nov 89 00:20 - Page 209:  
  13730.  
  13731.     NAME
  13732.     
  13733.             sfputc -- put a character to a stream
  13734.     
  13735.     
  13736.     PROTOTYPED IN:  mflfiles.h
  13737.     
  13738.     
  13739.     SYNOPSIS
  13740.     
  13741.             r = sfputc(ch,stream);
  13742.             int r;          character or EOF in case of error
  13743.             int ch;         character to output
  13744.             SFILE *stream;  stream to write
  13745.     
  13746.     
  13747.     DESCRIPTION
  13748.     
  13749.     The sfputc() function is an exact analog of the normal fputc() function
  13750.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13751.     
  13752.     
  13753.     EXAMPLE
  13754.     
  13755.             SFILE *outfile;
  13756.     
  13757.             outfile = sfopen("file.ext", "w");  /* output to a file     */
  13758.             if (EOF == sfputc('x', outfile))
  13759.                     puts("oops");
  13760.     
  13761.     
  13762.     SEE ALSO: sfopen(), scopen(), sclose(), sfgetc(), sfgets(), sfread(),
  13763.               sfputs(), sfwrite(), sfinstall(), crypt_install(), ucase_filt,
  13764.               lcase_filt
  13765.  
  13766.  
  13767.  
  13768.  
  13769.  
  13770.  
  13771.  
  13772.  
  13773.  
  13774.  
  13775.  
  13776.  
  13777.  
  13778.  
  13779.  
  13780.  
  13781.  
  13782.  
  13783.  
  13784.  
  13785.  
  13786.  
  13787.  
  13788.  
  13789.  
  13790.  
  13791.  
  13792.  
  13793.  
  13794.  
  13795. SFPUTS.FNC - Thu 23 Nov 89 00:20 - Page 210:  
  13796.  
  13797.     NAME
  13798.     
  13799.             sfputs -- put a string to a stream
  13800.     
  13801.     
  13802.     PROTOTYPED IN:  mflfiles.h
  13803.     
  13804.     
  13805.     SYNOPSIS
  13806.     
  13807.             r = sfputc(s,stream);
  13808.             int r;          SUCCESS if succesful
  13809.             char *s;        string to output
  13810.             SFILE *stream;  stream to write
  13811.     
  13812.     
  13813.     DESCRIPTION
  13814.     
  13815.     The sfputs() function is an exact analog of the normal fputs() function
  13816.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13817.     
  13818.     
  13819.     EXAMPLE
  13820.     
  13821.             SFILE *outfile;
  13822.     
  13823.             outfile = sfopen("file.ext", "w");  /* output to a file     */
  13824.             if (EOF == sfputc("test", outfile))
  13825.                     puts("oops");
  13826.     
  13827.     
  13828.     SEE ALSO: sfopen(), scopen(), sclose(), sfgetc(), sfgets(), sfread(),
  13829.               sfputc(), sfwrite(), sfinstall(), crypt_install(), ucase_filt,
  13830.               lcase_filt
  13831.  
  13832.  
  13833.  
  13834.  
  13835.  
  13836.  
  13837.  
  13838.  
  13839.  
  13840.  
  13841.  
  13842.  
  13843.  
  13844.  
  13845.  
  13846.  
  13847.  
  13848.  
  13849.  
  13850.  
  13851.  
  13852.  
  13853.  
  13854.  
  13855.  
  13856.  
  13857.  
  13858.  
  13859.  
  13860.  
  13861. SFREAD.FNC - Thu 23 Nov 89 00:20 - Page 211:  
  13862.  
  13863.     NAME
  13864.     
  13865.             sfread -- read a buffer from a stream
  13866.     
  13867.     
  13868.     PROTOTYPED IN:  mflfiles.h
  13869.     
  13870.     
  13871.     SYNOPSIS
  13872.     
  13873.             r = sfgetc(buf,size,n,stream);
  13874.             int r;          number of complete elements which were read
  13875.             char *buf;      buffer to receive data
  13876.             unsigned size;  size of elements to be read
  13877.             unsigned n;     number of elements to read
  13878.             SFILE *stream;  stream from which to read
  13879.     
  13880.     
  13881.     DESCRIPTION
  13882.     
  13883.     The sfread() function is an exact analog of the normal fread() function
  13884.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13885.     
  13886.     
  13887.     EXAMPLE
  13888.     
  13889.             SFILE *infile;
  13890.             char buf[1024];
  13891.     
  13892.             infile  = sfopen("file.ext", "r");  /* input from a file     */
  13893.             if (1024 != sfread(buf, 8, 128, infile))
  13894.                     puts("all done");
  13895.     
  13896.     
  13897.     SEE ALSO: sfopen(), scopen(), sclose(), sfgetc(), sfgets(), sfputc(),
  13898.               sfputs(), sfwrite(), sfinstall(), crypt_install(), ucase_filt,
  13899.               lcase_filt
  13900.  
  13901.  
  13902.  
  13903.  
  13904.  
  13905.  
  13906.  
  13907.  
  13908.  
  13909.  
  13910.  
  13911.  
  13912.  
  13913.  
  13914.  
  13915.  
  13916.  
  13917.  
  13918.  
  13919.  
  13920.  
  13921.  
  13922.  
  13923.  
  13924.  
  13925.  
  13926.  
  13927. SFWRITE.FNC - Thu 23 Nov 89 00:20 - Page 212:  
  13928.  
  13929.     NAME
  13930.     
  13931.             sfwrite -- write a buffer from a stream
  13932.     
  13933.     
  13934.     PROTOTYPED IN:  mflfiles.h
  13935.     
  13936.     
  13937.     SYNOPSIS
  13938.     
  13939.             r = sfgetc(buf,size,n,stream);
  13940.             int r;          number of complete elements which were written
  13941.             char *buf;      buffer to write
  13942.             unsigned size;  size of elements to write
  13943.             unsigned n;     number of elements to write
  13944.             SFILE *stream;  stream to write
  13945.     
  13946.     
  13947.     DESCRIPTION
  13948.     
  13949.     The sfwrite() function is an exact analog of the normal fwrite() function
  13950.     except that it is passed an SFILE pointer rather than a FILE pointer.
  13951.     
  13952.     
  13953.     EXAMPLE
  13954.     
  13955.             SFILE *outfile;
  13956.             char buf[1024];
  13957.     
  13958.             outfile  = sfopen("file.ext", "w");  /* output to a file     */
  13959.             if (1024 != sfwrite(buf, 8, 128, outfile))
  13960.                     puts("oops");
  13961.     
  13962.     
  13963.     SEE ALSO: sfopen(), scopen(), sclose(), sfgetc(), sfgets(), sfread(),
  13964.               sfputc(), sfputs(), sfinstall(), crypt_install(), ucase_filt,
  13965.               lcase_filt
  13966.  
  13967.  
  13968.  
  13969.  
  13970.  
  13971.  
  13972.  
  13973.  
  13974.  
  13975.  
  13976.  
  13977.  
  13978.  
  13979.  
  13980.  
  13981.  
  13982.  
  13983.  
  13984.  
  13985.  
  13986.  
  13987.  
  13988.  
  13989.  
  13990.  
  13991.  
  13992.  
  13993. SOUNDOFF.FNC - Thu 23 Nov 89 00:20 - Page 213:  
  13994.  
  13995.     NAME
  13996.     
  13997.             soundoff -- turn off the speaker
  13998.     
  13999.     
  14000.     PROTOTYPED IN:  mflsound.h
  14001.     
  14002.     
  14003.     SYNOPSIS
  14004.     
  14005.             void soundoff();
  14006.     
  14007.     
  14008.     DESCRIPTION
  14009.     
  14010.     This is a very low level function to manipulate the speaker port
  14011.     control.  It may be used with any function, but was developed for use
  14012.     with the mktone() function.  Timer values should be set before turning
  14013.     the speaker on.
  14014.     
  14015.     
  14016.     SEE ALSO: soundon()
  14017.  
  14018.  
  14019.  
  14020.  
  14021.  
  14022.  
  14023.  
  14024.  
  14025.  
  14026.  
  14027.  
  14028.  
  14029.  
  14030.  
  14031.  
  14032.  
  14033.  
  14034.  
  14035.  
  14036.  
  14037.  
  14038.  
  14039.  
  14040.  
  14041.  
  14042.  
  14043.  
  14044.  
  14045.  
  14046.  
  14047.  
  14048.  
  14049.  
  14050.  
  14051.  
  14052.  
  14053.  
  14054.  
  14055.  
  14056.  
  14057.  
  14058.  
  14059. SOUNDON.FNC - Thu 23 Nov 89 00:20 - Page 214:  
  14060.  
  14061.     NAME
  14062.     
  14063.             soundon -- turn on the speaker
  14064.     
  14065.     
  14066.     PROTOTYPED IN:  mflsound.h
  14067.     
  14068.     
  14069.     SYNOPSIS
  14070.     
  14071.             void soundon();
  14072.     
  14073.     
  14074.     DESCRIPTION
  14075.     
  14076.     This is a very low level function to manipulate the speaker
  14077.     port control.  It may be used with any function, but was developed
  14078.     for use with the mktone() function.  Timer values should be set
  14079.     before turning the speaker on.
  14080.     
  14081.     
  14082.     SEE ALSO: soundoff()
  14083.  
  14084.  
  14085.  
  14086.  
  14087.  
  14088.  
  14089.  
  14090.  
  14091.  
  14092.  
  14093.  
  14094.  
  14095.  
  14096.  
  14097.  
  14098.  
  14099.  
  14100.  
  14101.  
  14102.  
  14103.  
  14104.  
  14105.  
  14106.  
  14107.  
  14108.  
  14109.  
  14110.  
  14111.  
  14112.  
  14113.  
  14114.  
  14115.  
  14116.  
  14117.  
  14118.  
  14119.  
  14120.  
  14121.  
  14122.  
  14123.  
  14124.  
  14125. STR_ADD.FNC - Thu 23 Nov 89 00:20 - Page 215:  
  14126.  
  14127.     NAME
  14128.     
  14129.             string_add -- BASIC-style string concatenation
  14130.     
  14131.     
  14132.     PROTOTYPED IN:  mflstrng.h
  14133.     
  14134.     
  14135.     SYNOPSIS
  14136.     
  14137.             s = char *string_add(string,...,NULL);
  14138.             char *s;        target string
  14139.             char *string;   source string
  14140.     
  14141.     
  14142.     DESCRIPTION
  14143.     
  14144.     This is an emulation of the BASIC "A$=B$+C$" facility. It returns a
  14145.     concatenated string of its argument strings. This function uses
  14146.     the stralloc() funtion to allocate memory for the returned string.
  14147.     This memory is maintained in a circular pool and reused. See
  14148.     stralloc() for further information. Use strdup() or strcpy() to save
  14149.     the returned string in more permanent storage.
  14150.     
  14151.     
  14152.     EXAMPLE
  14153.     
  14154.             char *a = "European";
  14155.             char *b = "Hardware";
  14156.             char *c = "Skaters";
  14157.             a = string_add(left(a,2),right(b,2),mid(c,2,2),NULL));
  14158.             puts(a);
  14159.             /* prints "Eureka"       */
  14160.     
  14161.     
  14162.     SEE ALSO: right(), left(), mid(), str_init(), stralloc(), str_free()
  14163.  
  14164.  
  14165.  
  14166.  
  14167.  
  14168.  
  14169.  
  14170.  
  14171.  
  14172.  
  14173.  
  14174.  
  14175.  
  14176.  
  14177.  
  14178.  
  14179.  
  14180.  
  14181.  
  14182.  
  14183.  
  14184.  
  14185.  
  14186.  
  14187.  
  14188.  
  14189.  
  14190.  
  14191. STR_FREE.FNC - Thu 23 Nov 89 00:20 - Page 216:  
  14192.  
  14193.     NAME
  14194.     
  14195.             str_free -- free's the string pool
  14196.     
  14197.     
  14198.     PROTOTYPED IN:  mflstrng.h
  14199.     
  14200.     
  14201.     SYNOPSIS
  14202.     
  14203.             str_free();
  14204.     
  14205.     
  14206.     DESCRIPTION
  14207.     
  14208.     The str_free()function frees the memory used by stralloc() as a
  14209.     circular buffer of strings.
  14210.     
  14211.     
  14212.     EXAMPLE
  14213.     
  14214.             str_free();
  14215.     
  14216.     
  14217.     SEE ALSO: str_init(), stralloc()
  14218.  
  14219.  
  14220.  
  14221.  
  14222.  
  14223.  
  14224.  
  14225.  
  14226.  
  14227.  
  14228.  
  14229.  
  14230.  
  14231.  
  14232.  
  14233.  
  14234.  
  14235.  
  14236.  
  14237.  
  14238.  
  14239.  
  14240.  
  14241.  
  14242.  
  14243.  
  14244.  
  14245.  
  14246.  
  14247.  
  14248.  
  14249.  
  14250.  
  14251.  
  14252.  
  14253.  
  14254.  
  14255.  
  14256.  
  14257. STR_INIT.FNC - Thu 23 Nov 89 00:20 - Page 217:  
  14258.  
  14259.     NAME
  14260.     
  14261.             str_init   -- initialize a string pool
  14262.     
  14263.     
  14264.     PROTOTYPED IN:  mflstrng.h
  14265.     
  14266.     
  14267.     SYNOPSIS
  14268.     
  14269.             r = str_init(size,number);
  14270.             int r;          returns zero if successful, else
  14271.                             ERROR
  14272.             int size;       size of pre-allocated strings
  14273.             int number;     number of pre-allocated strings (must
  14274.                             be <= 128 in S or M models, or <=512
  14275.                             in C and L models)
  14276.     
  14277.     
  14278.     DESCRIPTION
  14279.     
  14280.     The underlying function for the BASIC-like string handling package is
  14281.     stralloc which maintains a pool of character buffers which it
  14282.     dispenses as requested and constantly reuses and reallocates as
  14283.     required. As a default, stralloc maintains a circular buffer of 16
  14284.     strings in Tiny, Small, and Medium models and 64 strings in Compact
  14285.     and Large models. These start out very small and grow as required.
  14286.     Should you wish to expand the number of strings or wish to
  14287.     pre-allocate strings of a given minimum size to avoid re- allocation,
  14288.     the str_init() function allows setting both parameters. You should
  14289.     use str_init() and set the global variable "STRALLOC_OK" to "FALSE"
  14290.     prior to using any of the other functions in any routine which
  14291.     explicitly calls free() to de-allocate memory. The str_init()
  14292.     function internally calls str_free() which may be used to free all
  14293.     memory in use by these functions. It is NOT generally recommended
  14294.     that str_free() be called by an application program since "holes" in
  14295.     memory may be created that DOS is later unable to resolve.
  14296.     
  14297.     
  14298.     EXAMPLE
  14299.     
  14300.             str_init(81, 50);       /* Pre-allocate 50-80 char strings */
  14301.     
  14302.     
  14303.     SEE ALSO: stralloc(), str_free()
  14304.  
  14305.  
  14306.  
  14307.  
  14308.  
  14309.  
  14310.  
  14311.  
  14312.  
  14313.  
  14314.  
  14315.  
  14316.  
  14317.  
  14318.  
  14319.  
  14320.  
  14321.  
  14322.  
  14323. STR_TERM.FNC - Thu 23 Nov 89 00:20 - Page 218:  
  14324.  
  14325.     NAME
  14326.     
  14327.             STRING_TERMINATOR -- returns terminating '\0'
  14328.     
  14329.     
  14330.     DEFINED IN:  mflstrng.h
  14331.     
  14332.     
  14333.     SYNOPSIS
  14334.     
  14335.              r = STRING_TERMINATOR(string);
  14336.              char r;         terminating '\0' in string
  14337.              char *string;   string to process
  14338.     
  14339.     
  14340.     DESCRIPTION
  14341.     
  14342.     This is one of the macros included in MFLSTRNG.H.  It simply returns
  14343.     evidence of a terminating '\0' in a string. It is occasionally useful when
  14344.     concatenating or processing strings to refer to `&STRING_TERMINATOR(str)'
  14345.     which is a pointer to the end of `str'.
  14346.     
  14347.     
  14348.     EXAMPLES
  14349.         
  14350.                 char *string = "Hello World\0";
  14351.     
  14352.                 if(STRING_TERMINATOR(string) == '\0')
  14353.                     puts(Yep, it's got a terminator);
  14354.     
  14355.     
  14356.     SEE ALSO: LAST_CHAR(), NEXT_TO_LAST_CHAR()
  14357.     
  14358.  
  14359.  
  14360.  
  14361.  
  14362.  
  14363.  
  14364.  
  14365.  
  14366.  
  14367.  
  14368.  
  14369.  
  14370.  
  14371.  
  14372.  
  14373.  
  14374.  
  14375.  
  14376.  
  14377.  
  14378.  
  14379.  
  14380.  
  14381.  
  14382.  
  14383.  
  14384.  
  14385.  
  14386.  
  14387.  
  14388.  
  14389. STRALLOC.FNC - Thu 23 Nov 89 00:20 - Page 219:  
  14390.  
  14391.     NAME
  14392.     
  14393.             stralloc   -- allocate a string from a string pool
  14394.     
  14395.     
  14396.     PROTOTYPED IN:  mflstrng.h
  14397.     
  14398.     
  14399.     SYNOPSIS
  14400.     
  14401.             extern LOGICAL STRALLOC_OK;
  14402.     
  14403.             s = stralloc(size);
  14404.             char *s;        returns a char buffer of length size,
  14405.                             else NULL if out of memory
  14406.             int size;       length of desired string
  14407.     
  14408.             Note: The LOGICAL data type is typedef'ed in MFLDEFS.H.
  14409.                   STRALLOC_OK grants permission for stralloc() to
  14410.                   resize any existing string should it be shorter
  14411.                   than requested. To avoid this situation, you
  14412.                   may pre-allocate all the strings in the pool to
  14413.                   a specified size using str_init(), below.
  14414.     
  14415.     
  14416.     
  14417.     DESCRIPTION
  14418.     
  14419.     This function supports the BASIC-like string functions. The
  14420.     underlying function is stralloc() which maintains a pool of character
  14421.     buffers which it dispenses as requested and constantly reuses and
  14422.     reallocates as required. As a default, stralloc maintains a circular
  14423.     buffer of 16 strings in Tiny, Small, and Medium models and 64 strings
  14424.     in Compact and Large models. These start out very small and grow as
  14425.     required.  Should you wish to expand the number of strings or wish to
  14426.     pre-allocate strings of a given minimum size to avoid re- allocation,
  14427.     the str_init() function allows setting both parameters.
  14428.     
  14429.     Since the strings are allocated from a circular buffer, if these
  14430.     routines are used within a recursive routine, it is strongly
  14431.     recommended that their results be copied (using strcpy() or strdup())
  14432.     into their own dedicated space. If the result is copied into a
  14433.     malloc'ed string which subsequently is free'd, you should
  14434.     pre-allocate the string pool using str_init(), as noted above.
  14435.     
  14436.     
  14437.     EXAMPLE
  14438.     
  14439.             char *a;
  14440.             a = stralloc(MAX_FLEN);
  14441.             /* Grabs reusable string space large enough for a filename */
  14442.     
  14443.     
  14444.     SEE ALSO: str_init(), str_free()
  14445.  
  14446.  
  14447.  
  14448.  
  14449.  
  14450.  
  14451.  
  14452.  
  14453.  
  14454.  
  14455. STREQ.FNC - Thu 23 Nov 89 00:20 - Page 220:  
  14456.  
  14457.     NAME
  14458.     
  14459.             STREQ -- compares strings TRUE/FALSE
  14460.     
  14461.     
  14462.     DEFINED IN:  mflstrng.h
  14463.     
  14464.     
  14465.     SYNOPSIS
  14466.     
  14467.             r = STREQ(s1,s2);
  14468.             LOGICAL r;      TRUE if strings match, else FALSE
  14469.             char *s1,*s2;   strings to compare
  14470.     
  14471.     
  14472.     DESCRIPTION
  14473.     
  14474.     This is one of the macros included in MFLSTRNG.H. The STREQ and STREQI
  14475.     macros are simply aliases to encapsulate strcmp() and strcmpl() so
  14476.     the return is inverted from its normal sense.
  14477.     
  14478.     
  14479.     EXAMPLES
  14480.         
  14481.             char *string1, string2;
  14482.             if (STREQ(string1,string2))
  14483.                 puts("the strings match");
  14484.             else pust("no match, but it reads more logically");
  14485.     
  14486.     
  14487.     SEE ALSO: STREQI()
  14488.     
  14489.  
  14490.  
  14491.  
  14492.  
  14493.  
  14494.  
  14495.  
  14496.  
  14497.  
  14498.  
  14499.  
  14500.  
  14501.  
  14502.  
  14503.  
  14504.  
  14505.  
  14506.  
  14507.  
  14508.  
  14509.  
  14510.  
  14511.  
  14512.  
  14513.  
  14514.  
  14515.  
  14516.  
  14517.  
  14518.  
  14519.  
  14520.  
  14521. STREQI.FNC - Thu 23 Nov 89 00:20 - Page 221:  
  14522.  
  14523.     NAME
  14524.     
  14525.             STREQI -- compares strings TRUE/FALSE, UC/LC
  14526.     
  14527.     
  14528.     PROTOTYPED IN:  mflstrng.h
  14529.     
  14530.     
  14531.     SYNOPSIS
  14532.     
  14533.              r = STREQI(s1,s2);
  14534.              LOGICAL r;      TRUE if strings match, else FALSE. Case is
  14535.                              ignored.
  14536.              char *s1,*s2;   strings to compare
  14537.     
  14538.     
  14539.     DESCRIPTION
  14540.     
  14541.     This one of the macros included in MFLSTRNG.H.  The STREQ and STREQI
  14542.     macros are simply aliases to encapsulate strcmp() and strcmpl() so the
  14543.     return is inverted from its normal sense.
  14544.     
  14545.     
  14546.     EXAMPLES
  14547.         
  14548.                 char *string1, string2;
  14549.                 if (STREQI(string1,string2))
  14550.                      puts("the strings match");
  14551.                 else pust("no match, but it reads more logically");
  14552.     
  14553.     
  14554.     SEE ALSO: STREQ()
  14555.  
  14556.  
  14557.  
  14558.  
  14559.  
  14560.  
  14561.  
  14562.  
  14563.  
  14564.  
  14565.  
  14566.  
  14567.  
  14568.  
  14569.  
  14570.  
  14571.  
  14572.  
  14573.  
  14574.  
  14575.  
  14576.  
  14577.  
  14578.  
  14579.  
  14580.  
  14581.  
  14582.  
  14583.  
  14584.  
  14585.  
  14586.  
  14587. STRFTIME.FNC - Thu 23 Nov 89 00:20 - Page 222:  
  14588.  
  14589.     NAME
  14590.     
  14591.             strftime -- convert data in tm structure to a string
  14592.     
  14593.     
  14594.     PROTOTYPED IN:  mfltime.h
  14595.     
  14596.     
  14597.     PORTABILITY:  ANSI - strftime() is fully compliant including locale
  14598.                   support
  14599.     
  14600.     
  14601.     SYNOPSIS
  14602.     
  14603.             r = strftime(buf,siz,fmt,tim);
  14604.             int r;           length of the formatted string
  14605.             char *buf;       buffer to receive the formatted string
  14606.             int siz;         size of the buffer
  14607.             struct tm *tim;  date/time data to format
  14608.     
  14609.     
  14610.     DESCRIPTION
  14611.     
  14612.     The strftime() function is defined in the ANSI draft but rarely
  14613.     implemented. It is like a printf() for time and date information.
  14614.     Country-specific formatting information may be specified - see
  14615.     setlocale(). 
  14616.     
  14617.     The conversion characters supported by strftime() are:
  14618.     
  14619.      %a      3-character abbreviated weekday, e.g. Thu
  14620.      %A      weekday name, e.g. Thursday
  14621.      %b      3-character abbreviated month, e.g. Jul
  14622.      %B      month name, e.g. July
  14623.      %c      standard format, e.g. Jul 13 14:27:39 1989
  14624.      %d      day of the month (01-31)
  14625.      %H      hour of the day (00-23)
  14626.      %I      hour of the day (01-12)
  14627.      %j      day of the year (001-365)
  14628.      %m      month (01-12)
  14629.      %M      minutes (00-59)
  14630.      %p      AM/PM indicator, e.g. PM
  14631.      %S      seconds (01-59)
  14632.      %U      week (starting Sundays) of the year (01-53)
  14633.      %w      weekday (0-6, Sunday = 0)
  14634.      %W      week (starting Mondays) of the year (01-53)
  14635.      %x      date, e.g. Jul 13 1989
  14636.      %X      time, e.g. 13:27:39
  14637.      %y      year (00-99)
  14638.      %Y      year with century (1970-2069)
  14639.      %Z      time zone (from TZ_txt & DST_flag), e.g. CST
  14640.      %%      literal '%' character
  14641.  
  14642.  
  14643.  
  14644.  
  14645.  
  14646.  
  14647.  
  14648.  
  14649.  
  14650.  
  14651.  
  14652.  
  14653. STRFTIME.FNC - Thu 23 Nov 89 00:20 - Page 223:  
  14654.  
  14655.  
  14656.     EXAMPLE
  14657.     
  14658.             #include <locale.h>
  14659.             extern struct LOC_TIME *loc_time;
  14660.             char buf[81];
  14661.     
  14662.             setlocale(LC_TIME, "C");         /* set defaults         */
  14663.     
  14664.             strftime(buf, 80, "%A %c (day %j)", t);
  14665.             /* buf = "Thursday Jul 13 14:27:39 1989 (day 194)"       */
  14666.     
  14667.             strftime(buf, 80, "%A, %B %d, %Y, %I:%M:%S %P %z", t);
  14668.             /* buf = "Thursday, July 13, 1989, 02:27:39 PM CST"      */
  14669.     
  14670.             loc_time->TZ_txt   = {"MST", "MDT"};
  14671.             loc_time->DST_flag = 1;
  14672.     
  14673.             strftime(buf, 80, "%d %b %y (%a) %H:%M:%S %z", t);
  14674.             /* buf = "13 Jul 89 (Thu) 14:27:39 MDT"                  */
  14675.     
  14676.     
  14677.     SEE ALSO: set_locale(), localeconv(), tzset()
  14678.  
  14679.  
  14680.  
  14681.  
  14682.  
  14683.  
  14684.  
  14685.  
  14686.  
  14687.  
  14688.  
  14689.  
  14690.  
  14691.  
  14692.  
  14693.  
  14694.  
  14695.  
  14696.  
  14697.  
  14698.  
  14699.  
  14700.  
  14701.  
  14702.  
  14703.  
  14704.  
  14705.  
  14706.  
  14707.  
  14708.  
  14709.  
  14710.  
  14711.  
  14712.  
  14713.  
  14714.  
  14715.  
  14716.  
  14717.  
  14718.  
  14719. STRIP.FNC - Thu 23 Nov 89 00:20 - Page 224:  
  14720.  
  14721.     NAME
  14722.     
  14723.             strip -- strip a newline from a string
  14724.     
  14725.     
  14726.     PROTOTYPED IN:  mflstrng.h
  14727.     
  14728.     
  14729.     SYNOPSIS
  14730.     
  14731.             void strip(str);
  14732.             char *str;
  14733.     
  14734.     
  14735.     DESCRIPTION
  14736.     
  14737.     If the specified string terminates with a newline (\n) character, this
  14738.     function will replace the character with a NULL.
  14739.     
  14740.     
  14741.     EXAMPLE
  14742.     
  14743.             char str[] = "This is a string\n";
  14744.             strip(str);
  14745.                the newline is stripped from str
  14746.  
  14747.  
  14748.  
  14749.  
  14750.  
  14751.  
  14752.  
  14753.  
  14754.  
  14755.  
  14756.  
  14757.  
  14758.  
  14759.  
  14760.  
  14761.  
  14762.  
  14763.  
  14764.  
  14765.  
  14766.  
  14767.  
  14768.  
  14769.  
  14770.  
  14771.  
  14772.  
  14773.  
  14774.  
  14775.  
  14776.  
  14777.  
  14778.  
  14779.  
  14780.  
  14781.  
  14782.  
  14783.  
  14784.  
  14785. STRIXLAT.FNC - Thu 23 Nov 89 00:20 - Page 225:  
  14786.  
  14787.     NAME
  14788.     
  14789.             strixlat  -- translates characters based on tables
  14790.     
  14791.     
  14792.     PROTOTYPED IN:  mflstrng.h
  14793.     
  14794.     
  14795.     SYNOPSIS
  14796.     
  14797.             r = strixlat(str,old,new);
  14798.             int r;          number of characters changed, ERROR if
  14799.                             size of `old' doesn't match size of `new'
  14800.             char *old;      characters to change, case ingonred
  14801.             char *new;      translated characters, case preserved
  14802.     
  14803.     
  14804.     DESCRIPTION
  14805.     
  14806.     This function replaces all occurrences of characters found in an input
  14807.     string and contained in a translation string to corresponding
  14808.     characters from a second translation string.
  14809.     
  14810.     
  14811.     EXAMPLE
  14812.     
  14813.             char *str="ABCxyzPpPpRrRr";
  14814.             strxlat(str,"abc","1234");       /* returns ERROR       */
  14815.             strxlat(str,"XYZabc","xyzABC");  /* returns zero        */
  14816.             strxlat(str,"xyzABC","MNOdef");  /* "defMNOPpPpRrRr"    */
  14817.             strixlat(str,"pr","ST");         /* "defMNOSsSsTtTt"    */
  14818.             strnixlat(str,"mno","ghi",2);    /* "defGHOSsSsTtTt"    */
  14819.     
  14820.     
  14821.     
  14822.     SEE ALSO: strxlat(), strnxlat(), strnixlat()
  14823.  
  14824.  
  14825.  
  14826.  
  14827.  
  14828.  
  14829.  
  14830.  
  14831.  
  14832.  
  14833.  
  14834.  
  14835.  
  14836.  
  14837.  
  14838.  
  14839.  
  14840.  
  14841.  
  14842.  
  14843.  
  14844.  
  14845.  
  14846.  
  14847.  
  14848.  
  14849.  
  14850.  
  14851. STRNIXLT.FNC - Thu 23 Nov 89 00:20 - Page 226:  
  14852.  
  14853.     NAME
  14854.     
  14855.             strnixlat -- translates first N characters based on tables
  14856.     
  14857.     
  14858.     PROTOTYPED IN:  mflstrng.h
  14859.     
  14860.     
  14861.     SYNOPSIS
  14862.     
  14863.             r = strnixlat(str,old,new,n);
  14864.             int r;          number of characters changed, ERROR if
  14865.                             size of `old' doesn't match size of `new'
  14866.             char *old;      characters to change, case ingonred
  14867.             char *new;      translated characters, case preserved
  14868.             int n;          translate first `n' occurances
  14869.     
  14870.     
  14871.     DESCRIPTION
  14872.     
  14873.     This function replaces the first N occurances of characters found in
  14874.     an input string and contained in a translation string to corresponding
  14875.     characters from a second translation string.
  14876.     
  14877.     
  14878.     EXAMPLE
  14879.     
  14880.             char *str="ABCxyzPpPpRrRr";
  14881.     
  14882.             strxlat(str,"abc","1234");       /* returns ERROR       */
  14883.             strxlat(str,"XYZabc","xyzABC");  /* returns zero        */
  14884.             strxlat(str,"xyzABC","MNOdef");  /* "defMNOPpPpRrRr"    */
  14885.             strixlat(str,"pr","ST");         /* "defMNOSsSsTtTt"    */
  14886.             strnixlat(str,"mno","ghi",2);    /* "defGHOSsSsTtTt"    */
  14887.     
  14888.     
  14889.     SEE ALSO: strxlat(), strnxlat(), strixlat()
  14890.  
  14891.  
  14892.  
  14893.  
  14894.  
  14895.  
  14896.  
  14897.  
  14898.  
  14899.  
  14900.  
  14901.  
  14902.  
  14903.  
  14904.  
  14905.  
  14906.  
  14907.  
  14908.  
  14909.  
  14910.  
  14911.  
  14912.  
  14913.  
  14914.  
  14915.  
  14916.  
  14917. STRNXLAT.FNC - Thu 23 Nov 89 00:20 - Page 227:  
  14918.  
  14919.     NAME
  14920.     
  14921.             strnxlat  -- translates first N characters based on tables
  14922.     
  14923.     
  14924.     PROTOTYPED IN:  mflstrng.h
  14925.     
  14926.     
  14927.     SYNOPSIS
  14928.     
  14929.              r = strnxlat(str,old,new,count);
  14930.              int r;          number of characters changed, ERROR if
  14931.                              size of `old' doesn't match size of `new'
  14932.              char *old;      characters to change
  14933.              char *new;      translated characters
  14934.              int n;          translate first `n' occurances
  14935.     
  14936.     
  14937.     DESCRIPTION
  14938.     
  14939.     This function replaces the first N occurances of characters found in
  14940.     an input string and contained in a translation string to corresponding
  14941.     characters from a second translation string.
  14942.     
  14943.     
  14944.     EXAMPLE
  14945.     
  14946.             char *str="ABCxyzPpPpRrRr";
  14947.             strxlat(str,"abc","1234");       /* returns ERROR       */
  14948.             strxlat(str,"XYZabc","xyzABC");  /* returns zero        */
  14949.             strxlat(str,"xyzABC","MNOdef");  /* "defMNOPpPpRrRr"    */
  14950.             strixlat(str,"pr","ST");         /* "defMNOSsSsTtTt"    */
  14951.             strnixlat(str,"mno","ghi",2);    /* "defGHOSsSsTtTt"    */
  14952.     
  14953.     
  14954.     SEE ALSO: strxlat(), strixlat(), strnixlat()
  14955.  
  14956.  
  14957.  
  14958.  
  14959.  
  14960.  
  14961.  
  14962.  
  14963.  
  14964.  
  14965.  
  14966.  
  14967.  
  14968.  
  14969.  
  14970.  
  14971.  
  14972.  
  14973.  
  14974.  
  14975.  
  14976.  
  14977.  
  14978.  
  14979.  
  14980.  
  14981.  
  14982.  
  14983. STRXLAT.FNC - Thu 23 Nov 89 00:20 - Page 228:  
  14984.  
  14985.     NAME
  14986.     
  14987.             strxlat   -- translates characters based on tables
  14988.     
  14989.     
  14990.     PROTOTYPED IN:  mflstrng.h
  14991.     
  14992.     
  14993.     SYNOPSIS
  14994.     
  14995.             r = strxlat(str,old,new);
  14996.             int r;          number of characters changed, ERROR if
  14997.                             size of `old' doesn't match size of `new'
  14998.             char *old;      characters to change
  14999.             char *new;      translated characters
  15000.     
  15001.     
  15002.     DESCRIPTION
  15003.     
  15004.     This function replaces all occurances of characters found in an input
  15005.     string and contained in a translation string to corresponding
  15006.     characters from a second translation string.
  15007.     
  15008.     
  15009.     EXAMPLE
  15010.     
  15011.             char *str="ABCxyzPpPpRrRr";
  15012.             strxlat(str,"abc","1234");       /* returns ERROR       */
  15013.             strxlat(str,"XYZabc","xyzABC");  /* returns zero        */
  15014.             strxlat(str,"xyzABC","MNOdef");  /* "defMNOPpPpRrRr"    */
  15015.             strixlat(str,"pr","ST");         /* "defMNOSsSsTtTt"    */
  15016.             strnixlat(str,"mno","ghi",2);    /* "defGHOSsSsTtTt"    */
  15017.     
  15018.     
  15019.     SEE ALSO: strnixlat(), strnxlat(), strixlat()
  15020.  
  15021.  
  15022.  
  15023.  
  15024.  
  15025.  
  15026.  
  15027.  
  15028.  
  15029.  
  15030.  
  15031.  
  15032.  
  15033.  
  15034.  
  15035.  
  15036.  
  15037.  
  15038.  
  15039.  
  15040.  
  15041.  
  15042.  
  15043.  
  15044.  
  15045.  
  15046.  
  15047.  
  15048.  
  15049. STUFF.FNC - Thu 23 Nov 89 00:20 - Page 229:  
  15050.  
  15051.     NAME
  15052.     
  15053.             stuff -- get equipment report (high level)
  15054.     
  15055.     
  15056.     PROTOTYPED IN:  mflsys.h
  15057.     
  15058.     
  15059.     SYNOPSIS
  15060.     
  15061.             r = _stuff(kind);
  15062.             int r;     result of test
  15063.             int kind;  kind of equipment to test for
  15064.     
  15065.     
  15066.     DESCRIPTION
  15067.     
  15068.     This function calls _stuff() and checks the appropriate
  15069.     bits returned depending upon the kind of information
  15070.     requested.  Kind is one of the following:
  15071.     
  15072.            0 = initial video mode
  15073.                 mode 0, 2, or 7 returned
  15074.            1 = number of disk drives
  15075.            2 = number of printers
  15076.            3 = number of serial ports
  15077.            4 = joystick installed
  15078.     
  15079.     
  15080.     EXAMPLE
  15081.     
  15082.             int r;
  15083.             r = stuff(0);
  15084.             if(r == 7) printf("Monochrome card installed");
  15085.  
  15086.  
  15087.  
  15088.  
  15089.  
  15090.  
  15091.  
  15092.  
  15093.  
  15094.  
  15095.  
  15096.  
  15097.  
  15098.  
  15099.  
  15100.  
  15101.  
  15102.  
  15103.  
  15104.  
  15105.  
  15106.  
  15107.  
  15108.  
  15109.  
  15110.  
  15111.  
  15112.  
  15113.  
  15114.  
  15115. TIME2JUL.FNC - Thu 23 Nov 89 00:20 - Page 230:  
  15116.  
  15117.     NAME
  15118.     
  15119.             time_to_julian -- convert time_t value to Julian date
  15120.     
  15121.     
  15122.     PROTOTYPED IN:  mfltime.h
  15123.     
  15124.     
  15125.     SYNOPSIS
  15126.     
  15127.             r = time_to_julian(time);
  15128.             long r;         Julian (scalar) date
  15129.             time_t time;    date/time to convert
  15130.     
  15131.     
  15132.     DESCRIPTION
  15133.     
  15134.     This function converts date and time information, as expressed in
  15135.     standard time_t data types, to scalar (Julian) dates. Only the date
  15136.     information is preserved, the time is lost.
  15137.     
  15138.     
  15139.     EXAMPLE
  15140.     
  15141.             long jday;
  15142.             time_t tim;
  15143.     
  15144.             /* Get today's date     */
  15145.     
  15146.             jday = time_to_julian(time(&tim));
  15147.     
  15148.     
  15149.     SEE ALSO: julian_to_ymd(), julian_to_wkday(), julian_to_yrday(),
  15150.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  15151.               ymd_to_julian(), tm_to_julian
  15152.  
  15153.  
  15154.  
  15155.  
  15156.  
  15157.  
  15158.  
  15159.  
  15160.  
  15161.  
  15162.  
  15163.  
  15164.  
  15165.  
  15166.  
  15167.  
  15168.  
  15169.  
  15170.  
  15171.  
  15172.  
  15173.  
  15174.  
  15175.  
  15176.  
  15177.  
  15178.  
  15179.  
  15180.  
  15181. TM2JUL.FNC - Thu 23 Nov 89 00:20 - Page 231:  
  15182.  
  15183.     NAME
  15184.     
  15185.             tm_to_julian      -- convert tm structure to Julian date
  15186.     
  15187.     
  15188.     PROTOTYPED IN:  mfltime.h
  15189.     
  15190.     
  15191.     SYNOPSIS
  15192.     
  15193.             r = tm_to_julian(t);
  15194.             long r;         Julian (scalar) date
  15195.             struct tm *t;   date/time data to convert
  15196.     
  15197.     
  15198.     DESCRIPTION
  15199.     
  15200.     This function converts date and time information, as included in
  15201.     standard tm structure, to scalar (Julian) dates. Only the date
  15202.     information is preserved, the time is lost.
  15203.     
  15204.     
  15205.     EXAMPLE
  15206.     
  15207.             long jday;
  15208.             time_t tim;
  15209.             struct tm *t;
  15210.     
  15211.             /* Get today's date     */
  15212.     
  15213.             time(&tim);
  15214.             jday = time_to_julian(localtime(&tim));
  15215.     
  15216.     
  15217.     SEE ALSO: julian_to_ymd(), julian_to_wkday(), julian_to_yrday(),
  15218.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  15219.               ymd_to_julian(), time_to_julian
  15220.  
  15221.  
  15222.  
  15223.  
  15224.  
  15225.  
  15226.  
  15227.  
  15228.  
  15229.  
  15230.  
  15231.  
  15232.  
  15233.  
  15234.  
  15235.  
  15236.  
  15237.  
  15238.  
  15239.  
  15240.  
  15241.  
  15242.  
  15243.  
  15244.  
  15245.  
  15246.  
  15247. TOUCH.FNC - Thu 23 Nov 89 00:20 - Page 232:  
  15248.  
  15249.     NAME
  15250.     
  15251.             touch    -- set file time/date stamp to the current time
  15252.     
  15253.     
  15254.     PROTOTYPED IN:  mfltime.h
  15255.     
  15256.     
  15257.     PORTABILITY: Unix
  15258.     
  15259.     
  15260.     SYNOPSIS
  15261.     
  15262.             r = touch(file);
  15263.             int r;           returns 0 if successful, else -1
  15264.             char *file;      file to set to curreent date & time
  15265.     
  15266.     
  15267.     DESCRIPTION
  15268.     
  15269.     The touch() function is similar to the unix command of the same name.
  15270.     Passed a file name, touch() sets its time/date stamp to the current
  15271.     time and date.
  15272.     
  15273.     
  15274.     EXAMPLE
  15275.     
  15276.             if (ERROR == touch("file.ext"))
  15277.                    puts("couldn't update time/date stamp");
  15278.     
  15279.     
  15280.     SEE ALSO: setftime()
  15281.  
  15282.  
  15283.  
  15284.  
  15285.  
  15286.  
  15287.  
  15288.  
  15289.  
  15290.  
  15291.  
  15292.  
  15293.  
  15294.  
  15295.  
  15296.  
  15297.  
  15298.  
  15299.  
  15300.  
  15301.  
  15302.  
  15303.  
  15304.  
  15305.  
  15306.  
  15307.  
  15308.  
  15309.  
  15310.  
  15311.  
  15312.  
  15313. TRUNC.FNC - Thu 23 Nov 89 00:20 - Page 233:  
  15314.  
  15315.     NAME
  15316.     
  15317.             trunc    -- truncate an open'ed file
  15318.     
  15319.     
  15320.     PROTOTYPED IN:  mflfiles.h
  15321.     
  15322.     
  15323.     SYNOPSIS
  15324.     
  15325.             result = trunc(fd,posn);
  15326.             int result;     SUCCESS or ERROR
  15327.             int fd;         handle of file to truncate
  15328.             long posn;      size of truncated file
  15329.     
  15330.     
  15331.     DESCRIPTION
  15332.     
  15333.     The trunc() function will truncate a file that has been opened using the
  15334.     file handle open() call. It will return an ERROR if the truncation length
  15335.     is longer than the existing file.
  15336.     
  15337.     
  15338.     EXAMPLE
  15339.     
  15340.             int fd;
  15341.             FILE *fp;
  15342.             char *fname[] = {"file1","file2","file3"};
  15343.             long sizes[]  = 100L, 200L, 300L;
  15344.             fd = open(fname[0], O_WRONLY);
  15345.             fp = fopen(fname[1], "wb");
  15346.             trunc(fd, sizes[0]);
  15347.             ftrunc(fp, sizes[1]);
  15348.             truncate(fname[2], sizes[2]);
  15349.     
  15350.     
  15351.     SEE ALSO: truncate(), ftrunc()
  15352.  
  15353.  
  15354.  
  15355.  
  15356.  
  15357.  
  15358.  
  15359.  
  15360.  
  15361.  
  15362.  
  15363.  
  15364.  
  15365.  
  15366.  
  15367.  
  15368.  
  15369.  
  15370.  
  15371.  
  15372.  
  15373.  
  15374.  
  15375.  
  15376.  
  15377.  
  15378.  
  15379. TRUNCATE.FNC - Thu 23 Nov 89 00:20 - Page 234:  
  15380.  
  15381.     NAME
  15382.     
  15383.             truncate -- truncate a named file
  15384.     
  15385.     
  15386.     PROTOTYPED IN:  mflfiles.h
  15387.     
  15388.     
  15389.     SYNOPSIS
  15390.     
  15391.             result = truncate(fname,posn);
  15392.             int result;     SUCCESS or ERROR
  15393.             char *fname;    name of file to truncate
  15394.             long posn;      size of truncated file
  15395.     
  15396.     
  15397.     DESCRIPTION
  15398.     
  15399.     This is one of the MFLIB routines which provide three different
  15400.     methods for truncating files to a given length - by name, handle or
  15401.     descriptor. They all work identically except that truncate() will
  15402.     check and return an ERROR if the truncation length is longer than the
  15403.     existing file.
  15404.     
  15405.     
  15406.     EXAMPLE
  15407.     
  15408.             int fd;
  15409.             FILE *fp;
  15410.             char *fname[] = {"file1","file2","file3"};
  15411.             long sizes[]  = 100L, 200L, 300L;
  15412.             fd = open(fname[0], O_WRONLY);
  15413.             fp = fopen(fname[1], "wb");
  15414.             trunc(fd, sizes[0]);
  15415.             ftrunc(fp, sizes[1]);
  15416.             truncate(fname[2], sizes[2]);
  15417.     
  15418.     
  15419.     SEE ALSO: ftrunc(), trunc()
  15420.  
  15421.  
  15422.  
  15423.  
  15424.  
  15425.  
  15426.  
  15427.  
  15428.  
  15429.  
  15430.  
  15431.  
  15432.  
  15433.  
  15434.  
  15435.  
  15436.  
  15437.  
  15438.  
  15439.  
  15440.  
  15441.  
  15442.  
  15443.  
  15444.  
  15445. UCASFILT.FNC - Thu 23 Nov 89 00:20 - Page 235:  
  15446.  
  15447.     NAME
  15448.     
  15449.             ucase_filt -- a filter to force streams to upper case
  15450.     
  15451.     
  15452.     DECLARED IN:  mflfiles.h
  15453.     
  15454.     
  15455.     SYNOPSIS
  15456.     
  15457.             r = sfinstall(stream,ucase_filt);
  15458.             int r;          SUCCESS or ERROR
  15459.             SFILE *stream;  stream to be filtered
  15460.     
  15461.     
  15462.     DESCRIPTION
  15463.     
  15464.     Not a function, ucase_filt is an SFILTER structure used with sfinstall()
  15465.     to force streams to upper case.
  15466.     
  15467.     
  15468.     EXAMPLE
  15469.     
  15470.             SFILE *infile;
  15471.     
  15472.             infile = sfopen("file.ext", "r");   /* input from a file      */
  15473.             crypt_install(infile, "keytxt", 0); /* encrypt using "keytxt" */
  15474.             sfinstall(infile, ucase_filt);      /* after converting to UC */
  15475.     
  15476.     
  15477.     SEE ALSO: sfopen(), scopen(), sclose(), sfinstall(), crypt_install(),
  15478.               lcase_filt
  15479.  
  15480.  
  15481.  
  15482.  
  15483.  
  15484.  
  15485.  
  15486.  
  15487.  
  15488.  
  15489.  
  15490.  
  15491.  
  15492.  
  15493.  
  15494.  
  15495.  
  15496.  
  15497.  
  15498.  
  15499.  
  15500.  
  15501.  
  15502.  
  15503.  
  15504.  
  15505.  
  15506.  
  15507.  
  15508.  
  15509.  
  15510.  
  15511. UNIX2DOS.FNC - Thu 23 Nov 89 00:20 - Page 236:  
  15512.  
  15513.     NAME
  15514.     
  15515.             unix2dos -- converts Unix-style paths to DOS-style
  15516.     
  15517.     
  15518.     PROTOTYPED IN:  mflfiles.h
  15519.     
  15520.     
  15521.     SYNOPSIS
  15522.     
  15523.             path = unix2dos(path);
  15524.             char *path;     pathname to convert
  15525.     
  15526.     
  15527.     DESCRIPTION
  15528.     
  15529.     unix2dos() converts Unix-style filenames (i.e. using the "/" character
  15530.     as a path separator) to DOS-style.
  15531.     
  15532.     
  15533.     EXAMPLE
  15534.         
  15535.              puts(unix2dos("unix_dos/style/path/name.ext"));
  15536.              /*  Prints "UNIX_DOS\STYLE\PATH\NAME.EXT"        */
  15537.     
  15538.     
  15539.     SEE ALSO: flnorm(), fln_fix()
  15540.  
  15541.  
  15542.  
  15543.  
  15544.  
  15545.  
  15546.  
  15547.  
  15548.  
  15549.  
  15550.  
  15551.  
  15552.  
  15553.  
  15554.  
  15555.  
  15556.  
  15557.  
  15558.  
  15559.  
  15560.  
  15561.  
  15562.  
  15563.  
  15564.  
  15565.  
  15566.  
  15567.  
  15568.  
  15569.  
  15570.  
  15571.  
  15572.  
  15573.  
  15574.  
  15575.  
  15576.  
  15577. USECCLK.FNC - Thu 23 Nov 89 00:20 - Page 237:  
  15578.  
  15579.     NAME
  15580.     
  15581.             usec_clock  -- read the system clock in microseconds
  15582.     
  15583.     
  15584.     PROTOTYPED IN:  mfltime.h
  15585.     
  15586.     
  15587.     SYNOPSIS
  15588.     
  15589.             t = usec_clock();
  15590.             uclock_t r;     returns zero if first call, thereafter
  15591.                             returns microseconds elapsed
  15592.     
  15593.     
  15594.     DESCRIPTION
  15595.     
  15596.     This is one of a group of timing functions with an accuracy of one
  15597.     microsecond on IBM and closely compatible computers. To function
  15598.     properly, these functions require the host system to use either an
  15599.     8253 or 8254 counter/timer chip based at I/O address 40h to generate
  15600.     the 18.2 Hz system interrupt used by DOS. These functions further
  15601.     assume that DOS uses the four bytes at 40:6C for its timekeeping
  15602.     function. These have proven to be safe assumptions for all IBM PC's
  15603.     and PS/2's, Compaq's, as well as most other clone computers and
  15604.     single-board computers designed for MS/PC-DOS compatibility. The sole
  15605.     exception is msec_pause() which requires the counter/timer chip but
  15606.     makes no other assumptions.
  15607.     
  15608.     The key function is usec_clock() which is a microsecond-accurate
  15609.     replacement for the normal clock() function. Just as the time
  15610.     returned by clock() may be converted to seconds by dividing by
  15611.     CLK_TCK, values returned by usec_clock may be similarly converted
  15612.     by dividing by UCLK_TCK, defined in MFLSYS.H.
  15613.     
  15614.     The usec_clock() function relies on data which rolls over at
  15615.     midnight each day and can handle this. However, if a program is to
  15616.     run continuously for many days, it becomes necessary to take
  15617.     action to prevent internal overflow. This may be done by resetting
  15618.     the internal registers used by usec_clock() at least once per day
  15619.     by calling restart_uclock().
  15620.  
  15621.  
  15622.  
  15623.  
  15624.  
  15625.  
  15626.  
  15627.  
  15628.  
  15629.  
  15630.  
  15631.  
  15632.  
  15633.  
  15634.  
  15635.  
  15636.  
  15637.  
  15638.  
  15639.  
  15640.  
  15641.  
  15642.  
  15643. USECCLK.FNC - Thu 23 Nov 89 00:20 - Page 238:  
  15644.  
  15645.  
  15646.     EXAMPLE
  15647.         
  15648.                 uclock_t time_1, time_2;
  15649.                 int i;
  15650.                 time_1 = usec_clock(); /* take an initial clock reading */
  15651.                 for (i = 1; i < 1000; ++i)
  15652.                 {
  15653.                     /* do things here but we don't know for how long */
  15654.                 }
  15655.                 time_2 = usec_delay(500000L); /* pause 0.5 sec, note time */
  15656.                 do {
  15657.                     /* do things here for 1.2345 seconds */
  15658.                     if (5000000L > usec_difftime(usec_clock() - time_1))
  15659.                             break; /* abort if total time is over 5 sec. */
  15660.                 } while (!timeout(time_2, usec_clock(), 1234500L));
  15661.     
  15662.     
  15663.     SEE ALSO: restart_uclock(), usec_delay(), usec_difftime(),
  15664.               usec_timeout(), msec_pause()
  15665.  
  15666.  
  15667.  
  15668.  
  15669.  
  15670.  
  15671.  
  15672.  
  15673.  
  15674.  
  15675.  
  15676.  
  15677.  
  15678.  
  15679.  
  15680.  
  15681.  
  15682.  
  15683.  
  15684.  
  15685.  
  15686.  
  15687.  
  15688.  
  15689.  
  15690.  
  15691.  
  15692.  
  15693.  
  15694.  
  15695.  
  15696.  
  15697.  
  15698.  
  15699.  
  15700.  
  15701.  
  15702.  
  15703.  
  15704.  
  15705.  
  15706.  
  15707.  
  15708.  
  15709. USECDIFF.FNC - Thu 23 Nov 89 00:20 - Page 239:  
  15710.  
  15711.     NAME
  15712.     
  15713.             usec_difftime  -- calculate the difference between two times
  15714.     
  15715.     
  15716.     DEFINED IN:  mfltime.h
  15717.     
  15718.     
  15719.     SYNOPSIS
  15720.     
  15721.             diff = usec_difftime(start, end);
  15722.             uclock_t diff;  microseconds elapsed between start & end
  15723.             uclock_t start; start time (from usec_clock())
  15724.             uclock_t end;   ending time (from usec_clock())
  15725.     
  15726.     
  15727.     DESCRIPTION
  15728.     
  15729.     This is part of a set of timing functions with an accuracy of one
  15730.     microsecond on IBM and closely compatible computers. The key function is
  15731.     usec_clock() which is a microsecond-accurate replacement for the normal
  15732.     clock() function. Just as the time returned by clock() may be converted
  15733.     to seconds by dividing by CLK_TCK, values returned by usec_clock may be
  15734.     similarly converted by dividing by UCLK_TCK, defined in MFLTIME.H.
  15735.     
  15736.     Two differential time functions are provided; usec_difftime(), a macro
  15737.     which simply returns the difference between two usec_clock() readings,
  15738.     and usec_timeout() which tests for an expired time limit.
  15739.     
  15740.     
  15741.     EXAMPLE
  15742.         
  15743.             uclock_t time_1, time_2;
  15744.             int i;
  15745.             time_1 = usec_clock(); /* take an initial clock reading */
  15746.             for (i = 1; i < 1000; ++i)
  15747.             {
  15748.                     /* do things here but we don't know for how long */
  15749.             }
  15750.             time_2 = usec_delay(500000L); /* pause 0.5 second, note time */
  15751.             do {
  15752.                     /* do things here for 1.2345 seconds */
  15753.                     if (5000000L > usec_difftime(usec_clock() - time_1))
  15754.                           break; /* abort if total time is over 5 sec. */
  15755.             } while (!timeout(time_2, usec_clock(), 1234500L));
  15756.     
  15757.     
  15758.     SEE ALSO: restart_uclock(), usec_clock(), usec_delay(),
  15759.               usec_timeout(), msec_pause()
  15760.  
  15761.  
  15762.  
  15763.  
  15764.  
  15765.  
  15766.  
  15767.  
  15768.  
  15769.  
  15770.  
  15771.  
  15772.  
  15773.  
  15774.  
  15775. USECDLY.FNC - Thu 23 Nov 89 00:20 - Page 240:  
  15776.  
  15777.     NAME
  15778.     
  15779.             usec_delay  -- delay a given number of microseconds
  15780.     
  15781.     
  15782.     PROTOTYPED IN:  mfltime.h
  15783.     
  15784.     
  15785.     SYNOPSIS
  15786.     
  15787.             end = usec_delay(usec);
  15788.             uclock_t end;   usec_clock() value at end of delay
  15789.             uclock_t usec;  number of microseconds to delay
  15790.     
  15791.     
  15792.     DESCRIPTION
  15793.     
  15794.     This part of a set of timing functions with an accuracy of one
  15795.     microsecond on IBM and closely compatible computers. To function
  15796.     properly, these functions require the host system to use either an
  15797.     8253 or 8254 counter/timer chip based at I/O address 40h to generate
  15798.     the 18.2 Hz system interrupt used by DOS. These functions further
  15799.     assume that DOS uses the four bytes at 40:6C for its timekeeping
  15800.     function. These have proven to be safe assumptions for all IBM PC's
  15801.     and PS/2's, Compaq's, as well as most other clone computers and
  15802.     single-board computers designed for MS/PC-DOS compatibility. The sole
  15803.     exception is msec_pause() which requires the counter/timer chip but
  15804.     makes no other assumptions.
  15805.     
  15806.     Two delay functions are provided; usec_delay() which is passed a
  15807.     number of microseconds, and msec_pause() which is passed a number
  15808.     of milliseconds. Other than the time units, one difference between
  15809.     the two is that msec_pause() is slightly more portable as noted
  15810.     above. Another difference is that usec_delay() returns the value
  15811.     returned by usec_clock() when it finished. This is done in order
  15812.     to be able to chain time measurements.
  15813.     
  15814.     
  15815.     EXAMPLE
  15816.         
  15817.             uclock_t time_1, time_2;
  15818.             int i;
  15819.             time_1 = usec_clock(); /* take an initial clock reading */
  15820.             for (i = 1; i < 1000; ++i)
  15821.             {
  15822.                  /* do things here but we don't know for how long */
  15823.             }
  15824.             time_2 = usec_delay(500000L); /* pause 0.5 second, note time */
  15825.             do {
  15826.                  /* do things here for 1.2345 seconds */
  15827.                if (5000000L > usec_difftime(usec_clock() - time_1))
  15828.                break; /* abort if total time is over 5 sec. */
  15829.             } while (!timeout(time_2, usec_clock(), 1234500L));
  15830.     
  15831.     
  15832.     SEE ALSO: restart_uclock(), usec_clock(), usec_difftime(),
  15833.               usec_timeout(), msec_pause()
  15834.  
  15835.  
  15836.  
  15837.  
  15838.  
  15839.  
  15840.  
  15841. USECTOUT.FNC - Thu 23 Nov 89 00:20 - Page 241:  
  15842.  
  15843.     NAME
  15844.     
  15845.             usec_timeout -- test for a timeout condition
  15846.     
  15847.     
  15848.     PROTOTYPED IN:  mfltime.h
  15849.     
  15850.     
  15851.     SYNOPSIS
  15852.     
  15853.             stat = usec_timeout(start, end, usecs);
  15854.             LOGICAL stat;   TRUE if time limit exceeded, else FALSE
  15855.             uclock_t start; start time (from usec_clock())
  15856.             uclock_t end;   ending time (from usec_clock())
  15857.             uclock_t usecs; time limit in microseconds
  15858.     
  15859.     
  15860.     DESCRIPTION
  15861.     
  15862.     This is part of a set of timing functions with an accuracy of one
  15863.     microsecond on IBM and closely compatible computers. The key function is
  15864.     usec_clock() which is a microsecond-accurate replacement for the normal
  15865.     clock() function. Just as the time returned by clock() may be converted
  15866.     to seconds by dividing by CLK_TCK, values returned by usec_clock may be
  15867.     similarly converted by dividing by UCLK_TCK, defined in MFLTIME.H.
  15868.     
  15869.     Two differential time functions are provided; usec_difftime(), a macro
  15870.     which simply returns the difference between two usec_clock() readings,
  15871.     and usec_timeout() which tests for an expired time limit.
  15872.     
  15873.     
  15874.     EXAMPLE
  15875.         
  15876.             uclock_t time_1, time_2;
  15877.             int i;
  15878.             time_1 = usec_clock(); /* take an initial clock reading */
  15879.             for (i = 1; i < 1000; ++i)
  15880.             {
  15881.                 /* do things here but we don't know for how long */
  15882.             }
  15883.             time_2 = usec_delay(500000L); /* pause 0.5 second, note time */
  15884.             do {
  15885.                 /* do things here for 1.2345 seconds */
  15886.                 if (5000000L > usec_difftime(usec_clock() - time_1))
  15887.                     break; /* abort if total time is over 5 sec. */
  15888.             } while (!timeout(time_2, usec_clock(), 1234500L));
  15889.     
  15890.     
  15891.     SEE ALSO: restart_uclock(), usec_clock(), usec_difftime(),
  15892.               usec_timeout(), msec_pause()
  15893.  
  15894.  
  15895.  
  15896.  
  15897.  
  15898.  
  15899.  
  15900.  
  15901.  
  15902.  
  15903.  
  15904.  
  15905.  
  15906.  
  15907. VIDBORDR.FNC - Thu 23 Nov 89 00:20 - Page 242:  
  15908.  
  15909.     NAME
  15910.     
  15911.             vid_border -- set border color
  15912.     
  15913.     
  15914.     PROTOTYPED IN:  mflconio.h
  15915.     
  15916.     
  15917.     SYNOPSIS
  15918.     
  15919.             (void) vid_border(clr);
  15920.             int clr;       one of the 16 color values
  15921.     
  15922.     
  15923.     
  15924.     DESCRIPTION
  15925.     
  15926.     This function and vid_palette manipulate the CGA card, or EGA card in
  15927.     CGA color mode.  vid_border() sets the border color outside the
  15928.     normal text area to any of the 16 possible colors.
  15929.     vid_palette() sets the working color palette, and has meaning
  15930.     only in CGA mode 4 (color 320 x 200).
  15931.            palette #          colors 0, 1, 2, 3
  15932.               0               background, green, red, brown
  15933.               1               background, cyan, magenta, white
  15934.     Call vid_palette() before using the vid_wrpix() function.
  15935.     In black&white 640 x 200 graphics mode, vid_border() will set
  15936.     the foreground color used for the display.  The background
  15937.     will always be black.
  15938.     
  15939.     
  15940.     EXAMPLE
  15941.     
  15942.             vmode(CG320);   /* set 320 color graphics mode */
  15943.             vid_border(BLUE);  /* set border and graphics background color */
  15944.             vid_palette(1);    /* select palette 1 */
  15945.             vid_wrpix(10, 10, 2)  /* write a pixel at x10, y10, color 2,
  15946.                                      which is magenta in palette 1 */
  15947.     
  15948.     
  15949.     SEE ALSO: vid_palette()
  15950.  
  15951.  
  15952.  
  15953.  
  15954.  
  15955.  
  15956.  
  15957.  
  15958.  
  15959.  
  15960.  
  15961.  
  15962.  
  15963.  
  15964.  
  15965.  
  15966.  
  15967.  
  15968.  
  15969.  
  15970.  
  15971.  
  15972.  
  15973. VIDPAGE.FNC - Thu 23 Nov 89 00:20 - Page 243:  
  15974.  
  15975.     NAME
  15976.     
  15977.             vidpage -- set a video page as active page
  15978.     
  15979.     
  15980.     PROTOTYPED IN:  mflconio.h
  15981.     
  15982.     
  15983.     SYNOPSIS
  15984.     
  15985.             void vidpage(page);
  15986.             int page;      0-7 depending upon mode
  15987.     
  15988.     
  15989.     DESCRIPTION
  15990.     
  15991.     This function sets the video display page to any page 0-7 subject to
  15992.     the effective video mode.  Note that the monochrome card does not
  15993.     support video pages and therefore this function will have no effect.
  15994.     
  15995.     
  15996.     EXAMPLE
  15997.     
  15998.          vidpage(0);    default lowest page
  15999.  
  16000.  
  16001.  
  16002.  
  16003.  
  16004.  
  16005.  
  16006.  
  16007.  
  16008.  
  16009.  
  16010.  
  16011.  
  16012.  
  16013.  
  16014.  
  16015.  
  16016.  
  16017.  
  16018.  
  16019.  
  16020.  
  16021.  
  16022.  
  16023.  
  16024.  
  16025.  
  16026.  
  16027.  
  16028.  
  16029.  
  16030.  
  16031.  
  16032.  
  16033.  
  16034.  
  16035.  
  16036.  
  16037.  
  16038.  
  16039. VIDPALET.FNC - Thu 23 Nov 89 00:20 - Page 244:  
  16040.  
  16041.     NAME
  16042.     
  16043.             vid_palette -- set color palette
  16044.     
  16045.     
  16046.     PROTOTYPED IN:  mflconio.h
  16047.     
  16048.     
  16049.     SYNOPSIS
  16050.     
  16051.             (void) vid_palette(num);
  16052.             int clr;       one of the 16 color values
  16053.             int num;       palette 0 or 1
  16054.     
  16055.     
  16056.     DESCRIPTION
  16057.     
  16058.     This function and vid_border() manipulate the CGA card, or EGA card in
  16059.     CGA color mode.  vid_border() sets the border color outside the normal
  16060.     text area to any of the 16 possible colors. vid_palette() sets the
  16061.     working color palette, and has meaning only in CGA mode 4 (color 320 x
  16062.     200).
  16063.     
  16064.           palette #          colors 0, 1, 2, 3
  16065.              0               background, green, red, brown
  16066.              1               background, cyan, magenta, white
  16067.     
  16068.     Call vid_palette() before using the vid_wrpix() function. In
  16069.     black&white 640 x 200 graphics mode, vid_border() will set the
  16070.     foreground color used for the display.  The background will always be
  16071.     black.
  16072.     
  16073.     
  16074.     EXAMPLE
  16075.     
  16076.             vmode(CG320);   /* set 320 color graphics mode */
  16077.             vid_border(BLUE);  /* set border and graphics background color */
  16078.             vid_palette(1);    /* select palette 1 */
  16079.             vid_wrpix(10, 10, 2)  /* write a pixel at x10, y10, color 2,
  16080.                                      which is magenta in palette 1 */
  16081.     
  16082.     
  16083.     
  16084.     SEE ALSO: vid_border()
  16085.  
  16086.  
  16087.  
  16088.  
  16089.  
  16090.  
  16091.  
  16092.  
  16093.  
  16094.  
  16095.  
  16096.  
  16097.  
  16098.  
  16099.  
  16100.  
  16101.  
  16102.  
  16103.  
  16104.  
  16105. VIDRDPIX.FNC - Thu 23 Nov 89 00:20 - Page 245:  
  16106.  
  16107.     NAME
  16108.     
  16109.             vid_rdpix -- read a pixel from the screen
  16110.     
  16111.     
  16112.     PROTOTYPED IN:  mflconio.h
  16113.             
  16114.     
  16115.     SYNOPSIS
  16116.     
  16117.             (void) vid_rdpix(x, y, clr);
  16118.             int x, y;      x and y screen coordinates
  16119.             int clr;       one of the 4 color values for current palette
  16120.     
  16121.     
  16122.     DESCRIPTION
  16123.     
  16124.     This function and vid_wrpix() manipulate the CGA card, or EGA card in
  16125.     CGA graphics mode.  vid_wrpix() will set the pixel at location x,y to
  16126.     the color clr, which is 0, 1, 2, or 3.  The real color will be as set
  16127.     via vid_palette().  For black and white 640 graphics, use 0 or 1 only.
  16128.     vid_rdpix() will return the color value (0-3) at the specified x,y
  16129.     location. If using black&white 640 x 200 graphics mode on a CGA, then
  16130.     the color value for vid_wrpix should be 0 or 1.  0 will set the pixel
  16131.     to black (which is the background color), and 1 will set the pixel to
  16132.     the color which has been previously selected by vid_border()  (the
  16133.     default is, of course, white).  In BW640 mode, therefore, the pixels
  16134.     can only be turned on or off.  There is no possibility of multi-color
  16135.     displays. These functions do not support the extra modes of the EGA or
  16136.     PGA adapters.
  16137.     
  16138.     
  16139.     EXAMPLE
  16140.     
  16141.             vmode(CG320);   /* set 320 color graphics mode */
  16142.             vid_border(BLUE);  /* set border and graphics background color */
  16143.             vid_palette(1);    /* select palette 1 */
  16144.             vid_wrpix(10, 10, 2)  /* write a pixel at x10, y10, color 2,
  16145.                                      which is magenta in palette 1 */
  16146.     
  16147.     
  16148.     
  16149.     SEE ALSO: vid_rdpix()
  16150.  
  16151.  
  16152.  
  16153.  
  16154.  
  16155.  
  16156.  
  16157.  
  16158.  
  16159.  
  16160.  
  16161.  
  16162.  
  16163.  
  16164.  
  16165.  
  16166.  
  16167.  
  16168.  
  16169.  
  16170.  
  16171. VIDWRPIX.FNC - Thu 23 Nov 89 00:20 - Page 246:  
  16172.  
  16173.     NAME
  16174.     
  16175.             vid_wrpix -- write a pixel to the screen
  16176.     
  16177.     
  16178.     PROTOTYPED IN:  mflconio.h
  16179.             
  16180.     
  16181.     SYNOPSIS
  16182.     
  16183.             (void) vid_wrpix(x, y, clr);
  16184.             int x, y;      x and y screen coordinates
  16185.             int clr;       one of the 4 color values for current palette
  16186.     
  16187.     
  16188.     DESCRIPTION
  16189.     
  16190.     This function and vid_rdpix() manipulate the CGA card, or EGA card in
  16191.     CGA graphics mode.  vid_wrpix() will set the pixel at location x,y to
  16192.     the color clr, which is 0, 1, 2, or 3.  The real color will be as set
  16193.     via vid_palette().  For black and white 640 graphics, use 0 or 1 only.
  16194.     vid_rdpix() will return the color value (0-3) at the specified x,y
  16195.     location. If using black&white 640 x 200 graphics mode on a CGA, then
  16196.     the color value for vid_wrpix should be 0 or 1.  0 will set the pixel
  16197.     to black (which is the background color), and 1 will set the pixel to
  16198.     the color which has been previously selected by vid_border()  (the
  16199.     default is, of course, white).  In BW640 mode, therefore, the pixels
  16200.     can only be turned on or off.  There is no possibility of multi-color
  16201.     displays. These functions do not support the extra modes of the EGA or
  16202.     PGA adapters.
  16203.     
  16204.     
  16205.     EXAMPLE
  16206.     
  16207.             vmode(CG320);   /* set 320 color graphics mode */
  16208.             vid_border(BLUE);  /* set border and graphics background color */
  16209.             vid_palette(1);    /* select palette 1 */
  16210.             vid_wrpix(10, 10, 2)  /* write a pixel at x10, y10, color 2,
  16211.                                      which is magenta in palette 1 */
  16212.     
  16213.     
  16214.     
  16215.     SEE ALSO: vid_rdpix()
  16216.  
  16217.  
  16218.  
  16219.  
  16220.  
  16221.  
  16222.  
  16223.  
  16224.  
  16225.  
  16226.  
  16227.  
  16228.  
  16229.  
  16230.  
  16231.  
  16232.  
  16233.  
  16234.  
  16235.  
  16236.  
  16237. VINIT.FNC - Thu 23 Nov 89 00:20 - Page 247:  
  16238.  
  16239.     NAME
  16240.     
  16241.             v_init -- obtains information on the video system
  16242.     
  16243.     
  16244.     PROTOTYPED IN:  mflconio.h
  16245.     
  16246.     
  16247.     SYNOPSIS
  16248.     
  16249.             v_init();
  16250.     
  16251.     
  16252.     DESCRIPTION
  16253.     
  16254.     The v_init() function analyzes the video system and filles in the global
  16255.     structure, v_info_, defined in MFLCONIO.H. Included in this structure are
  16256.     fields containing the following information:
  16257.     
  16258.     o  The number of rows displyable on the active display
  16259.     o  The number of columns displyable on the active display
  16260.     o  The video mode of the active display
  16261.     o  The active page of the active display
  16262.     o  The screen segment of the active display
  16263.     o  The screen address of the active display
  16264.     o  A flag to signal if DesqView or TopView is active
  16265.     
  16266.     
  16267.     EXAMPLE
  16268.     
  16269.             v_init();
  16270.             printf("displaying %d rows by %d cols\n",
  16271.                     v_info_.rows, v_info_.cols);
  16272.  
  16273.  
  16274.  
  16275.  
  16276.  
  16277.  
  16278.  
  16279.  
  16280.  
  16281.  
  16282.  
  16283.  
  16284.  
  16285.  
  16286.  
  16287.  
  16288.  
  16289.  
  16290.  
  16291.  
  16292.  
  16293.  
  16294.  
  16295.  
  16296.  
  16297.  
  16298.  
  16299.  
  16300.  
  16301.  
  16302.  
  16303. VISCROLL.FNC - Thu 23 Nov 89 00:20 - Page 248:  
  16304.  
  16305.     NAME
  16306.     
  16307.             viscroll -- scrolls the video display up or down
  16308.     
  16309.     
  16310.     PROTOTYPED IN:  mflconio.h
  16311.     
  16312.     
  16313.     PORTABILITY: Compatible with Blaise (tm) library function of the same
  16314.                  name.
  16315.     
  16316.     
  16317.     SYNOPSIS
  16318.     
  16319.             void viscroll(lines,atr,tlrow,tlcol,brrow,brcol,dir);
  16320.             int lines;     number of lines to scroll
  16321.             int atr;       video attribute of new lines
  16322.             int tlrow;     top left row
  16323.             int tlcol;     top left column
  16324.             int brrow;     bottom right row
  16325.             int brcol;     bottom right column
  16326.             int dir;       direction (SCR_UP or SCR_DN)
  16327.     
  16328.     
  16329.     DESCRIPTION
  16330.     
  16331.     The viscroll() function calls the BIOS video routines to directly
  16332.     scroll an area of the screen. The area to be scrolled is defined
  16333.     as a rectangular block whose upper left and bottom right co-
  16334.     ordinates are passed to viscroll(). As lines are scrolled, new
  16335.     ones appear to take their place whose video attribute is also
  16336.     specified. Finally, the direction to scroll is specified using the
  16337.     macro definitions SCR_UP and SCR_DN. If passed zero for the number
  16338.     of lines to scroll, the specified area is cleared to the specified
  16339.     attribute, acting like a windowed version of d_cls().
  16340.     
  16341.     
  16342.     EXAMPLE
  16343.     
  16344.          viscroll(2,NORMAL,0,0,7,79,SCR_UP);   /* scroll top 1/3 up 2 */
  16345.          viscroll(0,REVERSE,8,0,15,79,SCR_UP); /* clear middle 1/3    */
  16346.          viscroll(2,NORMAL,16,0,23,79,SCR_DN); /* scroll btm 1/3 dn 2 */
  16347.  
  16348.  
  16349.  
  16350.  
  16351.  
  16352.  
  16353.  
  16354.  
  16355.  
  16356.  
  16357.  
  16358.  
  16359.  
  16360.  
  16361.  
  16362.  
  16363.  
  16364.  
  16365.  
  16366.  
  16367.  
  16368.  
  16369. VMODE.FNC - Thu 23 Nov 89 00:20 - Page 249:  
  16370.  
  16371.     NAME
  16372.     
  16373.             vmode -- set video mode
  16374.     
  16375.     
  16376.     PROTOTYPED IN:  mflconio.h
  16377.     
  16378.     
  16379.     SYNOPSIS
  16380.     
  16381.             void vmode(mode);
  16382.             int mode;
  16383.     
  16384.     
  16385.     DESCRIPTION
  16386.     
  16387.     This function sets the video mode from 0 - 7.  Modes are as specified
  16388.     in the DOS manual.  The most common is Black & White 80 column mode,
  16389.     which is mode 2. This library package includes screen.h which defines
  16390.     video modes.
  16391.     
  16392.     
  16393.     EXAMPLE
  16394.     
  16395.          #include <screen.h>
  16396.          vmode(BW80);
  16397.  
  16398.  
  16399.  
  16400.  
  16401.  
  16402.  
  16403.  
  16404.  
  16405.  
  16406.  
  16407.  
  16408.  
  16409.  
  16410.  
  16411.  
  16412.  
  16413.  
  16414.  
  16415.  
  16416.  
  16417.  
  16418.  
  16419.  
  16420.  
  16421.  
  16422.  
  16423.  
  16424.  
  16425.  
  16426.  
  16427.  
  16428.  
  16429.  
  16430.  
  16431.  
  16432.  
  16433.  
  16434.  
  16435. WEEKDAY.FNC - Thu 23 Nov 89 00:20 - Page 250:  
  16436.  
  16437.     NAME
  16438.     
  16439.             weekday -- Determine the day of the week form the date
  16440.     
  16441.     
  16442.     PROTOTYPED IN:  mfltime.h
  16443.     
  16444.     
  16445.     SYNOPSIS
  16446.     
  16447.             value = weekday(month, day, year);
  16448.             int value;      returns 0-6
  16449.             int month;      number of month 1-12
  16450.             int day;        number of date 1-31
  16451.             int year;       year starting with 1980
  16452.     
  16453.     
  16454.     DESCRIPTION
  16455.     
  16456.     This function returns the number of the day in the week for any
  16457.     date from January 1, 1980.  Sunday is day 0, and Saturday is day 6.
  16458.     
  16459.     
  16460.     EXAMPLE
  16461.     
  16462.           for July 2, 1986:
  16463.           int value;
  16464.           value = weekday(7, 2, 1986);
  16465.     
  16466.           value for this date will be 3 (Wednesday)
  16467.           You may wish me a Happy Birthday.
  16468.     
  16469.     
  16470.     SEE ALSO: julian_to_dayname(), julian_to_wkday()
  16471.  
  16472.  
  16473.  
  16474.  
  16475.  
  16476.  
  16477.  
  16478.  
  16479.  
  16480.  
  16481.  
  16482.  
  16483.  
  16484.  
  16485.  
  16486.  
  16487.  
  16488.  
  16489.  
  16490.  
  16491.  
  16492.  
  16493.  
  16494.  
  16495.  
  16496.  
  16497.  
  16498.  
  16499.  
  16500.  
  16501. WILDNAME.FNC - Thu 23 Nov 89 00:20 - Page 251:  
  16502.  
  16503.     NAME
  16504.     
  16505.             wildname -- matches filenames against a pattern
  16506.     
  16507.     
  16508.     PROTOTYPED IN:  mflfiles.h
  16509.     
  16510.     
  16511.     SYNOPSIS
  16512.     
  16513.             r=wildname(pat, str, rule);
  16514.             int r;         zero if match, else non-zero     
  16515.             char *pat;     pattern to match - may contain wildcards
  16516.             char *str;     filename to match
  16517.             int rule;      universal wildcard rules - may be:
  16518.                            0           - no universal wildcards
  16519.                            DOS_STYLE   - "." matches anything
  16520.                            UNIX_STYLE  - "*" matches anything
  16521.                            BOTH_STYLES - "*", or "." match anything
  16522.     
  16523.     
  16524.     DESCRIPTION
  16525.     
  16526.     There are times when you need to manually perform a wildcard
  16527.     pattern match on a filename rather than let DOS do it for you.
  16528.     There also times when you'd like the pattern matching to be a
  16529.     little smarter than DOS's. The wildname() function performs both
  16530.     services. Passed a pattern and a filename (no path or directory
  16531.     specs allowed, though), it will return a value similar to strcmp()
  16532.     if the filename matches the pattern. It is also smart enough to
  16533.     properly handle embedded '*' wildcards which DOS can't do. A '?'
  16534.     wildcard will match any character. A '*' wildcard may match zero
  16535.     or more occurances of any character(s). Optionally, wildname()
  16536.     allows either, both or neither DOS or Unix-style unversal pattern
  16537.     matching. The universal DOS pattern is "." and will match any file
  16538.     name. The universal Unix pattern is "*". The implicit universal
  16539.     pattern is "*.*" and will match any file name regardless of which
  16540.     style (if any) universal pattern is selected. Finally, note that
  16541.     if DOS style pattern matching is specified, the smart "*" wildcard
  16542.     pattern matching is disabled in order to fully emulate DOS's brain
  16543.     damaged wildcard processing.
  16544.  
  16545.  
  16546.  
  16547.  
  16548.  
  16549.  
  16550.  
  16551.  
  16552.  
  16553.  
  16554.  
  16555.  
  16556.  
  16557.  
  16558.  
  16559.  
  16560.  
  16561.  
  16562.  
  16563.  
  16564.  
  16565.  
  16566.  
  16567. WILDNAME.FNC - Thu 23 Nov 89 00:20 - Page 252:  
  16568.  
  16569.  
  16570.     EXAMPLES
  16571.     
  16572.          wildname("A*C.E?T", "ABC.EXT", 0); /* matches      */
  16573.          wildname("A*C.E?T", "ABX.EXT", 0); /* no match     */
  16574.          wildname("A*C.E?T", "ALEC.EXT", 0);/* matches      */
  16575.          wildname("A*C.E?T", "ABC.ET", 0);  /* no match     */
  16576.          wildname("A*C.E*T", "ABC.ET", 0);  /* matches      */
  16577.          wildname("*.*", "ABC.XYZ", 0);     /* matches      */
  16578.          wildname(".", "ABC.XYZ", 1);       /* matches      */
  16579.          wildname("*", "ABC.XYZ", 2);       /* matches      */
  16580.          wildname(".", "ABC.XYZ", 3);       /* matches      */
  16581.          wildname("*", "ABC.XYZ", 3);       /* matches      */
  16582.          wildname("A*C.X*Z", "ABZ.XYC", 0); /* no match     */
  16583.          wildname("A*C.X*Z", "ABZ.XYC", 1); /* matches      */
  16584.          wildname("A*C.X*Z", "ABZ.XYC", 2); /* no match     */
  16585.          wildname("A*C.X*Z", "ABZ.XYC", 3); /* no match     */
  16586.     
  16587.     
  16588.     SEE ALSO:  dirmask()
  16589.  
  16590.  
  16591.  
  16592.  
  16593.  
  16594.  
  16595.  
  16596.  
  16597.  
  16598.  
  16599.  
  16600.  
  16601.  
  16602.  
  16603.  
  16604.  
  16605.  
  16606.  
  16607.  
  16608.  
  16609.  
  16610.  
  16611.  
  16612.  
  16613.  
  16614.  
  16615.  
  16616.  
  16617.  
  16618.  
  16619.  
  16620.  
  16621.  
  16622.  
  16623.  
  16624.  
  16625.  
  16626.  
  16627.  
  16628.  
  16629.  
  16630.  
  16631.  
  16632.  
  16633. WKDAYNM.FNC - Thu 23 Nov 89 00:20 - Page 253:  
  16634.  
  16635.     NAME
  16636.     
  16637.             wkdayname -- return a pointer to name of day string
  16638.     
  16639.     
  16640.     PROTOTYPED IN:  mfltime.h
  16641.     
  16642.     
  16643.     SYNOPSIS
  16644.     
  16645.             char *wkdayname(day);
  16646.             int day;        day number 0-6
  16647.     
  16648.     
  16649.     DESCRIPTION
  16650.     
  16651.     This function returns a character pointer to a text string naming the
  16652.     day of the week indicated by the day parameter. Day 0 is Sunday, and
  16653.     day 6 is Saturday.  Strings are null terminated and may be used
  16654.     directly or copied to another string.
  16655.     
  16656.     
  16657.     EXAMPLE
  16658.     
  16659.            printf("Today is %s", wkdayname(3));
  16660.            /* output is :
  16661.                 Today is Wednesday
  16662.            */
  16663.  
  16664.  
  16665.  
  16666.  
  16667.  
  16668.  
  16669.  
  16670.  
  16671.  
  16672.  
  16673.  
  16674.  
  16675.  
  16676.  
  16677.  
  16678.  
  16679.  
  16680.  
  16681.  
  16682.  
  16683.  
  16684.  
  16685.  
  16686.  
  16687.  
  16688.  
  16689.  
  16690.  
  16691.  
  16692.  
  16693.  
  16694.  
  16695.  
  16696.  
  16697.  
  16698.  
  16699. WRTCHAR.FNC - Thu 23 Nov 89 00:20 - Page 254:  
  16700.  
  16701.     NAME
  16702.     
  16703.             writechar -- send a char to the serial port
  16704.     
  16705.     
  16706.     PROTOTYPED IN:  mflsys.h
  16707.     
  16708.     
  16709.     SYNOPSIS
  16710.     
  16711.             (void) writechar(port, r);
  16712.             unsigned char r;   character to send or receive
  16713.             int port;          port number
  16714.     
  16715.     
  16716.     DESCRIPTION
  16717.     
  16718.     This is part of some very low level (direct port access) subroutines
  16719.     included to enable I/O through COM1 through COM4.  Only setport() uses
  16720.     BIOS int 14H.  These functions are not intended to be the ultimate in
  16721.     async functions, but a starting point for an integrated set of async
  16722.     functions, and a means of getting at the serial port directly for
  16723.     speed and to work around the problems that some "clone" BIOS routines
  16724.     have in returning proper status values.  File "MFLDEFS.H" contains
  16725.     #defines to handle these ports mnemonically.
  16726.     
  16727.     writechar() will place the specified unsigned char into the
  16728.     transmitter buffer register where it will be sent.
  16729.     
  16730.     If the program "loop" is short and fast enough, these functions will
  16731.     be ample to allow communications at up to 9600 baud. A program has
  16732.     already been implemented to communicate with a prom programmer at this
  16733.     rate, so it can be done.  However, when the program does not poll the
  16734.     receiver fast enough it is likely that characters may be lost and the
  16735.     maximum usable baud rate will be lower.  It is highly unlikely that
  16736.     baud rates less than 2400 baud will be necessary if the program is
  16737.     properly structured.
  16738.     
  16739.     
  16740.     EXAMPLE
  16741.     
  16742.             /* this routine receives characters from COM1 at one
  16743.             ** speed and resends them to COM2 at another speed */
  16744.     
  16745.             unsigned char i;
  16746.     
  16747.             setport(SER1, 0xe3);  /* set COM1 to 9600 baud, No parity,
  16748.                                    ** 8-bits, 1 stop bit */
  16749.             setport(SER2, 0xc3);  /* set COM2 the same, except 4800 baud */
  16750.     
  16751.             while(TRUE) {
  16752.                 if(!ready_rcv(SER1)) continue;  /* wait for a char */
  16753.                 i = readchar(SER1);     /* fetch it */
  16754.                 while(!ready_xmt(SER2));/* wait for transmitter to be ready */
  16755.                 writechar(SER2, i);  /* then send it */
  16756.             }
  16757.     
  16758.     
  16759.     SEE ALSO: readchar(), ready_rcv(), ready_xmt(), setport()
  16760.  
  16761.  
  16762.  
  16763.  
  16764.  
  16765. YMD2JUL.FNC - Thu 23 Nov 89 00:20 - Page 255:  
  16766.  
  16767.     NAME
  16768.     
  16769.             ymd_to_julian -- convert year, month, date to Julian date
  16770.     
  16771.     
  16772.     PROTOTYPED IN:  mfltime.h
  16773.     
  16774.     
  16775.     SYNOPSIS
  16776.     
  16777.             r = ymd_to_julian(yr,mo,day);
  16778.             long r;         Julian (scalar) date
  16779.             unsigned yr;    year
  16780.             unsigned mo;    month
  16781.             unsigned day;   date
  16782.     
  16783.     
  16784.     DESCRIPTION
  16785.     
  16786.     This function converts dates expressed in days, months, and years
  16787.     into scalar (Julian) dates.
  16788.     
  16789.     
  16790.     EXAMPLE
  16791.     
  16792.             long jday;
  16793.     
  16794.             jday=ymd_to_julian(1974,6,9);
  16795.     
  16796.     
  16797.     SEE ALSO: julian_to_ymd(), julian_to_wkday(), julian_to_yrday(),
  16798.               julian_to_dayname(), julian_to_time(), julian_to_tm(),
  16799.               time_to_julian(), tm_to_julian
  16800.  
  16801.  
  16802.  
  16803.  
  16804.  
  16805.  
  16806.  
  16807.  
  16808.  
  16809.  
  16810.  
  16811.  
  16812.  
  16813.  
  16814.  
  16815.  
  16816.  
  16817.  
  16818.  
  16819.  
  16820.  
  16821.  
  16822.  
  16823.  
  16824.  
  16825.  
  16826.  
  16827.  
  16828.  
  16829.  
  16830.  
  16831. _GETDI.FNC - Thu 23 Nov 89 00:20 - Page 256:  
  16832.  
  16833.     NAME
  16834.     
  16835.             _getdi -- get device information for file handle
  16836.     
  16837.     
  16838.     PROTOTYPED IN:  mflsys.h
  16839.     
  16840.     
  16841.     SYNOPSIS
  16842.     
  16843.             r = _getdi(fh);
  16844.             int r;      status byte, low 8 bits only
  16845.             int fh;     DOS file handle to investigate
  16846.     
  16847.     
  16848.     DESCRIPTION
  16849.     
  16850.     This function returns the lower 8 bits of the control word for the
  16851.     specified file handle, usually stdout, stdin, or one of the other
  16852.     standard channels.  Note that a file handle, NOT file descriptor is
  16853.     required.  Refer to the DOS manual for the description of all the
  16854.     bits. Bit 7 set indicates a character device, and bits 0,1 refer to
  16855.     the console.  This function is called by the functions isatty() and
  16856.     iscons().
  16857.     
  16858.     
  16859.     EXAMPLE
  16860.     
  16861.           int r;
  16862.           int fh;
  16863.           fh = fileno(stdout);    /* get file handle for stdout */
  16864.           r = _getdi(fh);
  16865.           if(r >= 0x80) printf("stdout is a character device");
  16866.  
  16867.  
  16868.  
  16869.  
  16870.  
  16871.  
  16872.  
  16873.  
  16874.  
  16875.  
  16876.  
  16877.  
  16878.  
  16879.  
  16880.  
  16881.  
  16882.  
  16883.  
  16884.  
  16885.  
  16886.  
  16887.  
  16888.  
  16889.  
  16890.  
  16891.  
  16892.  
  16893.  
  16894.  
  16895.  
  16896.  
  16897. _STUFF.FNC - Thu 23 Nov 89 00:20 - Page 257:  
  16898.  
  16899.     NAME
  16900.     
  16901.             _stuff -- get equipment report (low level)
  16902.     
  16903.     
  16904.     PROTOTYPED IN:  mflsys.h
  16905.     
  16906.     
  16907.     SYNOPSIS
  16908.     
  16909.             r = _stuff();
  16910.             int r;
  16911.     
  16912.     
  16913.     DESCRIPTION
  16914.     
  16915.     Returns an integer from DOS int 11H, indicating the
  16916.     available equipment and initial video mode.  This
  16917.     is a low level function.  For a higher level function,
  16918.     refer to stuff().
  16919.          bits 15, 14 = # of printers installed
  16920.          bit 12      = joystick installed if 1
  16921.          bits 11-9   = # of serial ports installed
  16922.          bits 7-6    = # of disk drives, 1-4 if bit 0 = 1
  16923.          bits 5-4    = Initial video mode:
  16924.                        01  40 x 25 b/w CGA
  16925.                        10  80 x 25 b/w CGA
  16926.                        11  80 x 25 Mono card
  16927.          bit 0       = no disk drives if 0
  16928.     
  16929.     
  16930.     EXAMPLE
  16931.     
  16932.              int r;
  16933.              r = _stuff();
  16934.              /* test bit 12 (game port) */
  16935.              if((r & 0x1000) != 0) printf("Game port installed");
  16936.  
  16937.  
  16938.  
  16939.  
  16940.  
  16941.  
  16942.  
  16943.  
  16944.  
  16945.  
  16946.  
  16947.  
  16948.  
  16949.  
  16950.  
  16951.  
  16952.  
  16953.  
  16954.  
  16955.  
  16956.  
  16957.  
  16958.  
  16959.  
  16960.  
  16961.  
  16962.  
  16963.